本文整理汇总了Java中com.google.gerrit.common.data.PermissionRule.setRange方法的典型用法代码示例。如果您正苦于以下问题:Java PermissionRule.setRange方法的具体用法?Java PermissionRule.setRange怎么用?Java PermissionRule.setRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gerrit.common.data.PermissionRule
的用法示例。
在下文中一共展示了PermissionRule.setRange方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: grant
import com.google.gerrit.common.data.PermissionRule; //导入方法依赖的package包/类
public static void grant(
ProjectConfig config,
AccessSection section,
LabelType type,
int min,
int max,
GroupReference... groupList) {
String name = Permission.LABEL + type.getName();
Permission p = section.getPermission(name, true);
for (GroupReference group : groupList) {
if (group != null) {
PermissionRule r = rule(config, group);
r.setRange(min, max);
p.add(r);
}
}
}
示例2: allow
import com.google.gerrit.common.data.PermissionRule; //导入方法依赖的package包/类
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;
}
示例3: blockLabel
import com.google.gerrit.common.data.PermissionRule; //导入方法依赖的package包/类
public static PermissionRule blockLabel(
ProjectConfig project,
String labelName,
int min,
int max,
AccountGroup.UUID group,
String ref) {
PermissionRule r = grant(project, Permission.LABEL + labelName, newRule(project, group), ref);
r.setBlock();
r.setRange(min, max);
return r;
}
示例4: configureDefault
import com.google.gerrit.common.data.PermissionRule; //导入方法依赖的package包/类
private static void configureDefault(
Map<String, List<PermissionRule>> out,
AccessSection section,
String capName,
GroupReference group) {
if (doesNotDeclare(section, capName)) {
PermissionRange.WithDefaults range = GlobalCapability.getRange(capName);
if (range != null) {
PermissionRule rule = new PermissionRule(group);
rule.setRange(range.getDefaultMin(), range.getDefaultMax());
out.put(capName, Collections.singletonList(rule));
}
}
}
示例5: addGroup
import com.google.gerrit.common.data.PermissionRule; //导入方法依赖的package包/类
private void addGroup(GroupReference ref) {
if (ref.getUUID() != null) {
if (value.getRule(ref) == null) {
PermissionRule newRule = value.getRule(ref, true);
if (validRange != null) {
int min = validRange.getDefaultMin();
int max = validRange.getDefaultMax();
newRule.setRange(min, max);
} else if (GlobalCapability.PRIORITY.equals(value.getName())) {
newRule.setAction(PermissionRule.Action.BATCH);
}
rules.getList().add(newRule);
}
groupToAdd.setValue(null);
groupToAdd.setFocus(true);
} else {
// If the oracle didn't get to complete a UUID, resolve it now.
//
addRule.setEnabled(false);
GroupMap.suggestAccountGroupForProject(
projectName.get(),
ref.getName(),
1,
new GerritCallback<GroupMap>() {
@Override
public void onSuccess(GroupMap result) {
addRule.setEnabled(true);
if (result.values().length() == 1) {
addGroup(
new GroupReference(
result.values().get(0).getGroupUUID(), result.values().get(0).name()));
} else {
groupToAdd.setFocus(true);
new ErrorDialog(Gerrit.M.noSuchGroupMessage(ref.getName())).center();
}
}
@Override
public void onFailure(Throwable caught) {
addRule.setEnabled(true);
super.onFailure(caught);
}
});
}
}