use of com.google.gerrit.entities.Permission in project gerrit by GerritCodeReview.
the class AbstractQueryChangesTest method grant.
protected void grant(Project.NameKey project, String ref, String permission, boolean force, AccountGroup.UUID groupUUID) throws RepositoryNotFoundException, IOException, ConfigInvalidException {
try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
md.setMessage(String.format("Grant %s on %s", permission, ref));
ProjectConfig config = projectConfigFactory.read(md);
config.upsertAccessSection(ref, s -> {
Permission.Builder p = s.upsertPermission(permission);
PermissionRule.Builder rule = PermissionRule.builder(GroupReference.create(groupUUID, groupUUID.get())).setForce(force);
p.add(rule);
});
config.commit(md);
projectCache.evictAndReindex(config.getProject());
}
}
Aggregations