本文整理汇总了Java中com.google.gerrit.common.data.PermissionRule.setMin方法的典型用法代码示例。如果您正苦于以下问题:Java PermissionRule.setMin方法的具体用法?Java PermissionRule.setMin怎么用?Java PermissionRule.setMin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gerrit.common.data.PermissionRule
的用法示例。
在下文中一共展示了PermissionRule.setMin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: grantLabel
import com.google.gerrit.common.data.PermissionRule; //导入方法依赖的package包/类
protected void grantLabel(
String label,
int min,
int max,
Project.NameKey project,
String ref,
boolean force,
AccountGroup.UUID groupUUID,
boolean exclusive)
throws RepositoryNotFoundException, IOException, ConfigInvalidException {
String permission = Permission.LABEL + label;
try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
md.setMessage(String.format("Grant %s on %s", permission, ref));
ProjectConfig config = ProjectConfig.read(md);
AccessSection s = config.getAccessSection(ref, true);
Permission p = s.getPermission(permission, true);
p.setExclusiveGroup(exclusive);
PermissionRule rule = Util.newRule(config, groupUUID);
rule.setForce(force);
rule.setMin(min);
rule.setMax(max);
p.add(rule);
config.commit(md);
projectCache.evict(config.getProject());
}
}
示例2: allow
import com.google.gerrit.common.data.PermissionRule; //导入方法依赖的package包/类
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);
}
示例3: block
import com.google.gerrit.common.data.PermissionRule; //导入方法依赖的package包/类
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;
}
示例4: setProjectPermissions
import com.google.gerrit.common.data.PermissionRule; //导入方法依赖的package包/类
private void setProjectPermissions() {
addPermissions(AccessSection.ALL, Permission.OWNER);
addPermissions(
CODE_REVIEW_REFS,
Permission.READ,
Permission.PUSH,
Permission.REMOVE_REVIEWER,
Permission.SUBMIT,
Permission.REBASE);
PermissionRule reviewRange = new PermissionRule(getMyGroup());
reviewRange.setMin(new Integer(-2));
reviewRange.setMax(new Integer(+2));
addPermission(CODE_REVIEW_REFS, Permission.LABEL + CODE_REVIEW_LABEL, reviewRange);
PermissionRule verifiedRange = new PermissionRule(getMyGroup());
verifiedRange.setMin(new Integer(-1));
verifiedRange.setMax(new Integer(+1));
addPermission(CODE_REVIEW_REFS, Permission.LABEL + VERIFIED_LABEL, verifiedRange);
addPermissions(AccessSection.HEADS, Permission.READ, Permission.CREATE, Permission.PUSH_MERGE);
PermissionRule forcePush = new PermissionRule(getMyGroup());
forcePush.setForce(Boolean.TRUE);
addPermission(AccessSection.HEADS, Permission.PUSH, forcePush);
addPermissions(TAGS_REFS, Permission.PUSH);
PermissionRule removeTag = new PermissionRule(getMyGroup());
removeTag.setForce(Boolean.TRUE);
addPermission(TAGS_REFS, Permission.PUSH, removeTag);
}
示例5: getAccessSections
import com.google.gerrit.common.data.PermissionRule; //导入方法依赖的package包/类
List<AccessSection> getAccessSections(Map<String, AccessSectionInfo> sectionInfos)
throws UnprocessableEntityException {
if (sectionInfos == null) {
return Collections.emptyList();
}
List<AccessSection> sections = new ArrayList<>(sectionInfos.size());
for (Map.Entry<String, AccessSectionInfo> entry : sectionInfos.entrySet()) {
if (entry.getValue().permissions == null) {
continue;
}
AccessSection accessSection = new AccessSection(entry.getKey());
for (Map.Entry<String, PermissionInfo> permissionEntry :
entry.getValue().permissions.entrySet()) {
if (permissionEntry.getValue().rules == null) {
continue;
}
Permission p = new Permission(permissionEntry.getKey());
if (permissionEntry.getValue().exclusive != null) {
p.setExclusiveGroup(permissionEntry.getValue().exclusive);
}
for (Map.Entry<String, PermissionRuleInfo> permissionRuleInfoEntry :
permissionEntry.getValue().rules.entrySet()) {
GroupDescription.Basic group = groupsCollection.parseId(permissionRuleInfoEntry.getKey());
if (group == null) {
throw new UnprocessableEntityException(
permissionRuleInfoEntry.getKey() + " is not a valid group ID");
}
PermissionRuleInfo pri = permissionRuleInfoEntry.getValue();
PermissionRule r = new PermissionRule(GroupReference.forGroup(group));
if (pri != null) {
if (pri.max != null) {
r.setMax(pri.max);
}
if (pri.min != null) {
r.setMin(pri.min);
}
r.setAction(GetAccess.ACTION_TYPE.inverse().get(pri.action));
if (pri.force != null) {
r.setForce(pri.force);
}
}
p.add(r);
}
accessSection.getPermissions().add(p);
}
sections.add(accessSection);
}
return sections;
}