use of com.google.gerrit.common.data.PermissionRule in project gerrit by GerritCodeReview.
the class RefControlTest method unblockForceWithAllowNoForce_NotPossible.
@Test
public void unblockForceWithAllowNoForce_NotPossible() {
PermissionRule r = block(local, PUSH, ANONYMOUS_USERS, "refs/heads/*");
r.setForce(true);
allow(local, PUSH, DEVS, "refs/heads/*");
ProjectControl u = user(local, DEVS);
assertCannotForceUpdate("refs/heads/master", u);
}
use of com.google.gerrit.common.data.PermissionRule in project gerrit by GerritCodeReview.
the class Util method newRule.
public static PermissionRule newRule(ProjectConfig project, AccountGroup.UUID groupUUID) {
GroupReference group = new GroupReference(groupUUID, groupUUID.get());
group = project.resolve(group);
return new PermissionRule(group);
}
use of com.google.gerrit.common.data.PermissionRule in project gerrit by GerritCodeReview.
the class Util method allow.
public static PermissionRule allow(ProjectConfig project, String permissionName, int min, int max, AccountGroup.UUID group, String ref) {
PermissionRule rule = newRule(project, group);
rule.setMin(min);
rule.setMax(max);
return grant(project, permissionName, rule, ref);
}
use of com.google.gerrit.common.data.PermissionRule in project gerrit by GerritCodeReview.
the class Util method block.
public static PermissionRule block(ProjectConfig project, String permissionName, int min, int max, AccountGroup.UUID group, String ref) {
PermissionRule rule = newRule(project, group);
rule.setMin(min);
rule.setMax(max);
PermissionRule r = grant(project, permissionName, rule, ref);
r.setBlock();
return r;
}
use of com.google.gerrit.common.data.PermissionRule in project gerrit by GerritCodeReview.
the class Util method allow.
public static PermissionRule allow(ProjectConfig project, String capabilityName, AccountGroup.UUID group) {
PermissionRule rule = newRule(project, group);
project.getAccessSection(AccessSection.GLOBAL_CAPABILITIES, true).getPermission(capabilityName, true).add(rule);
if (GlobalCapability.hasRange(capabilityName)) {
PermissionRange.WithDefaults range = GlobalCapability.getRange(capabilityName);
if (range != null) {
rule.setRange(range.getDefaultMin(), range.getDefaultMax());
}
}
return rule;
}
Aggregations