use of com.google.gerrit.entities.AccessSection in project gerrit by GerritCodeReview.
the class CheckAccessIT method noRules.
@Test
@Sandboxed
public void noRules() throws Exception {
normalProject = projectOperations.newProject().create();
for (AccessSection section : projectOperations.project(allProjectsName).getProjectConfig().getAccessSections()) {
if (!section.getName().startsWith(Constants.R_REFS)) {
continue;
}
for (Permission permission : section.getPermissions()) {
projectOperations.project(allProjectsName).forUpdate().remove(permissionKey(permission.getName()).ref(section.getName()).build()).update();
}
}
AccessCheckInput input = new AccessCheckInput();
input.account = privilegedUser.email();
input.permission = Permission.READ;
input.ref = "refs/heads/main";
AccessCheckInfo info = gApi.projects().name(normalProject.get()).checkAccess(input);
assertThat(info.status).isEqualTo(403);
assertThat(info.debugLogs).isNotEmpty();
assertThat(info.debugLogs.get(0)).contains("Found no rules");
}
use of com.google.gerrit.entities.AccessSection 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);
}
Aggregations