use of com.google.gerrit.extensions.api.access.ProjectAccessInput in project gerrit by GerritCodeReview.
the class AccessIT method addGlobalCapabilityForNonRootProject.
@Test
public void addGlobalCapabilityForNonRootProject() throws Exception {
ProjectAccessInput accessInput = newProjectAccessInput();
AccessSectionInfo accessSectionInfo = createDefaultGlobalCapabilitiesAccessSectionInfo();
accessInput.add.put(AccessSection.GLOBAL_CAPABILITIES, accessSectionInfo);
exception.expect(BadRequestException.class);
pApi.access(accessInput);
}
use of com.google.gerrit.extensions.api.access.ProjectAccessInput in project gerrit by GerritCodeReview.
the class AccessIT method setPermissionsWithDisallowedUser.
@Test
public void setPermissionsWithDisallowedUser() throws Exception {
// Add initial permission set
ProjectAccessInput accessInput = newProjectAccessInput();
AccessSectionInfo accessSectionInfo = createAccessSectionInfoDenyAll();
// Disallow READ
accessInput.add.put(REFS_ALL, accessSectionInfo);
pApi.access(accessInput);
// Create a change to apply
ProjectAccessInput accessInfoToApply = newProjectAccessInput();
AccessSectionInfo accessSectionInfoToApply = createDefaultAccessSectionInfo();
accessInfoToApply.add.put(REFS_HEADS, accessSectionInfoToApply);
setApiUser(user);
exception.expect(ResourceNotFoundException.class);
gApi.projects().name(newProjectName).access();
}
use of com.google.gerrit.extensions.api.access.ProjectAccessInput in project gerrit by GerritCodeReview.
the class AccessIT method getPermissionsWithDisallowedUser.
@Test
public void getPermissionsWithDisallowedUser() throws Exception {
// Add initial permission set
ProjectAccessInput accessInput = newProjectAccessInput();
AccessSectionInfo accessSectionInfo = createAccessSectionInfoDenyAll();
// Disallow READ
accessInput.add.put(REFS_ALL, accessSectionInfo);
pApi.access(accessInput);
setApiUser(user);
exception.expect(ResourceNotFoundException.class);
gApi.projects().name(newProjectName).access();
}
use of com.google.gerrit.extensions.api.access.ProjectAccessInput in project gerrit by GerritCodeReview.
the class AccessIT method newProjectAccessInput.
private ProjectAccessInput newProjectAccessInput() {
ProjectAccessInput p = new ProjectAccessInput();
p.add = new HashMap<>();
p.remove = new HashMap<>();
return p;
}
use of com.google.gerrit.extensions.api.access.ProjectAccessInput in project gerrit by GerritCodeReview.
the class AccessIT method addGlobalCapabilityAsAdmin.
@Test
public void addGlobalCapabilityAsAdmin() throws Exception {
ProjectAccessInput accessInput = newProjectAccessInput();
AccessSectionInfo accessSectionInfo = createDefaultGlobalCapabilitiesAccessSectionInfo();
accessInput.add.put(AccessSection.GLOBAL_CAPABILITIES, accessSectionInfo);
ProjectAccessInfo updatedAccessSectionInfo = gApi.projects().name(allProjects.get()).access(accessInput);
assertThat(updatedAccessSectionInfo.local.get(AccessSection.GLOBAL_CAPABILITIES).permissions.keySet()).containsAllIn(accessSectionInfo.permissions.keySet());
}
Aggregations