use of com.google.gerrit.server.project.ProjectConfig in project gerrit by GerritCodeReview.
the class TagsIT method setupPermissions.
@Before
public void setupPermissions() throws Exception {
try (ProjectConfigUpdate u = updateProject(allProjects)) {
ProjectConfig cfg = u.getConfig();
removeAllBranchPermissions(cfg, Permission.CREATE, Permission.CREATE_TAG, Permission.CREATE_SIGNED_TAG);
u.save();
}
}
use of com.google.gerrit.server.project.ProjectConfig in project gerrit by GerritCodeReview.
the class ProjectOperationsImplTest method getProjectConfigNoRefsMetaConfig.
@Test
public void getProjectConfigNoRefsMetaConfig() throws Exception {
Project.NameKey key = projectOperations.newProject().create();
deleteRefsMetaConfig(key);
ProjectConfig projectConfig = projectOperations.project(key).getProjectConfig();
assertThat(projectConfig.getName()).isEqualTo(key);
assertThat(projectConfig.getRevision()).isNull();
}
use of com.google.gerrit.server.project.ProjectConfig in project gerrit by GerritCodeReview.
the class LabelNormalizerTest method configureProject.
private void configureProject() throws Exception {
ProjectConfig pc = loadAllProjects();
for (AccessSection sec : pc.getAccessSections()) {
pc.upsertAccessSection(sec.getName(), updatedSection -> {
for (String label : pc.getLabelSections().keySet()) {
updatedSection.removePermission(forLabel(label));
}
});
}
LabelType lt = label(LabelId.VERIFIED, value(1, LabelId.VERIFIED), value(0, "No score"), value(-1, "Fails"));
pc.upsertLabelType(lt);
save(pc);
}
use of com.google.gerrit.server.project.ProjectConfig 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