-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
Default policy user count is reduced twice for the same set of users.
On line 53 the unsafe users are removed from the users being sprayed. Then on line 59 the the fine grained policy users are subtracted from the user count. This results in the default policy user count being reduced twice for the same users.
var removedUnsafe = Users.RemoveAll(x => x.UserState != UserState.SAFE_TO_SPRAY);
var fineGrainedPoliciesUserCount = Policies
.Where(x => x.IsFineGrained)
.Sum(y => y.AppliesToUsers.Count());
var defaultPolicyUserCount = Users.Count() - fineGrainedPoliciesUserCount;
var removedExcluded = Users.RemoveAll(x => excluded.Contains(x.Username, StringComparer.OrdinalIgnoreCase));
_logger.Log($"Default Policy: {defaultPolicyUserCount} total user(s)");
_logger.Log($"Fine Grained Policies: {fineGrainedPoliciesUserCount} total user(s)");
_logger.Log($"Removed {removedUnsafe} unsafe user(s)");
_logger.Log($"Removed {removedExcluded} excluded user(s)");
_logger.Log($"Preparing to spray {Users.Count} user(s)");
A simple fix is to move the removedUnsafe line below where the defaultPolicyUserCount is being set.
Metadata
Metadata
Assignees
Labels
No labels