Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions RoleMining.Library/Algorithms/JaccardIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ public List<Score> CalculateScores(IEnumerable<UserAccess> userAccesses, IEnumer
var userAccessValidator = new UserAccessValidator();
var userInRoleValidator = new UserInRoleValidator();

// TODO: Move validation outside of the method
userAccessValidator.ValidateAndThrowArgumentExceptions(userAccesses, nameof(userAccesses));
userInRoleValidator.ValidateAndThrowArgumentExceptions(userInRoles, nameof(userInRoles));


// Bad data handling
// To be implented

// Access -> Users
var accessesWithListOfUsers = userAccesses.GroupBy(uA => uA.AccessID)
.ToDictionary(group => group.Key, group => new HashSet<string>(group.Select(uA => uA.UserID).ToList()));
Expand Down Expand Up @@ -100,9 +97,11 @@ public List<Score> CalculateScores(IEnumerable<UserAccess> userAccesses, IEnumer
RoleID = roleID,
AccessID = accessID,
UsersWithAccessAndRoleCount = usersWithRoleAndExtraAccess,
UsersWithAccessWithoutRoleCount = usersWithExtraAccess.Count() - usersWithRoleAndExtraAccess,
UsersWithoutAccessWithRoleCount = usersWithRole.Count() - usersWithRoleAndExtraAccess,
UsersWithAccessAndRole = usersWithRole.Intersect(usersWithExtraAccess).OrderBy(u => u).ToList(),
UsersWithoutAccessWithRole = usersWithRole.Except(usersWithExtraAccess).OrderBy(u => u).ToList()
UsersWithoutAccessWithRole = usersWithRole.Except(usersWithExtraAccess).OrderBy(u => u).ToList(),
UsersWithAccessWithoutRole = usersWithExtraAccess.Except(usersWithRole).OrderBy(u => u).ToList()
});
}
}
Expand Down
10 changes: 10 additions & 0 deletions RoleMining.Library/Classes/Score.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public class Score
/// </summary>
public int UsersWithAccessAndRoleCount { get; set; }

/// <summary>
/// Amount of users with the access, but not with the role
/// </summary>
public int UsersWithAccessWithoutRoleCount { get; set; }

/// <summary>
/// Amount of users with the role, but not with the access
/// </summary>
Expand All @@ -37,6 +42,11 @@ public class Score
/// </summary>
public List<string> UsersWithAccessAndRole { get; set; }

/// <summary>
/// List of userIDs with the access, but not with the role
/// </summary>
public List<string> UsersWithAccessWithoutRole { get; set; }

/// <summary>
/// List of UserIDs with the role, but not with the access
/// </summary>
Expand Down