GetAccess: Fix read config permission check

In I3707ff00 this was changed in GetAccess such that it no longer
matches ProjectAccessFactory. The change seemed harmless, but had
unintended consequences. Revert to the known-working implementation
while further investigation is underway.

Bug: Issue 7495
Change-Id: If42f1f2ae725e66fede8139a8bcccab3bedfbf99
This commit is contained in:
Dave Borowitz
2017-10-25 11:16:00 -04:00
parent 96423a9e7d
commit f5bd0f71d3
2 changed files with 5 additions and 1 deletions

View File

@@ -125,6 +125,8 @@ class ProjectAccessFactory extends Handler<ProjectAccess> {
}
}
// The following implementation must match the GetAccess REST API endpoint.
List<AccessSection> local = new ArrayList<>();
Set<String> ownerOf = new HashSet<>();
Map<AccountGroup.UUID, Boolean> visibleGroups = new HashMap<>();

View File

@@ -162,10 +162,12 @@ public class GetAccess implements RestReadView<ProjectResource> {
throw new ResourceNotFoundException(rsrc.getName());
}
// The following implementation must match the ProjectAccessFactory JSON RPC endpoint.
info.local = new HashMap<>();
info.ownerOf = new HashSet<>();
Map<AccountGroup.UUID, GroupInfo> visibleGroups = new HashMap<>();
boolean canReadConfig = check(perm, ProjectPermission.READ_CONFIG);
boolean canReadConfig = check(perm, RefNames.REFS_CONFIG, READ);
boolean canWriteConfig = check(perm, ProjectPermission.WRITE_CONFIG);
for (AccessSection section : config.getAccessSections()) {