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