Make PermissionCollection constructor take perUser boolean

Previously the username string was used to determine if the collection
isUserSpecific. Simplify the code to just take the condition in the
constructor.

Change-Id: I8313866d3c9435e57dde078c67a19db7be6baca3
This commit is contained in:
Colby Ranger
2013-12-10 14:45:21 -08:00
parent de5dd7ea13
commit 15fd4c29b2

View File

@@ -140,21 +140,20 @@ public class PermissionCollection {
}
}
return new PermissionCollection(permissions, ruleProps,
perUser ? username : null);
return new PermissionCollection(permissions, ruleProps, perUser);
}
}
private final Map<String, List<PermissionRule>> rules;
private final Map<PermissionRule, ProjectRef> ruleProps;
private final String username;
private final boolean perUser;
private PermissionCollection(Map<String, List<PermissionRule>> rules,
Map<PermissionRule, ProjectRef> ruleProps,
String username) {
boolean perUser) {
this.rules = rules;
this.ruleProps = ruleProps;
this.username = username;
this.perUser = perUser;
}
/**
@@ -162,7 +161,7 @@ public class PermissionCollection {
* this collection, making the results user specific.
*/
public boolean isUserSpecific() {
return username != null;
return perUser;
}
/**