summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2011-06-07 08:10:31 -0700
committerShawn O. Pearce <sop@google.com>2011-06-07 08:13:30 -0700
commitd12c47672c291fa5caac0135f5afaca6a1d4d7de (patch)
tree210fb910289cf086ef2c85accaa22f5477c4395f
parent9fb03c8bc905f492f1369e99186bda77de59e981 (diff)
Fix administration of projects with no access controls
If a project has no access controls listed in its project.config, nobody was able to add new sections in the web UI. Ensure that users are at least able to create new sections if they have owner power on any reference, which may be inherited down from parent projects or be implied because of their site administrator status. Bug: issue 1000 Change-Id: I19bab2a75fe3248275fef9fd87ed86cfa580845a Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectAccessFactory.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectAccessFactory.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectAccessFactory.java
index 3ae3ac52b2..68b54d1e99 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectAccessFactory.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ProjectAccessFactory.java
@@ -111,6 +111,13 @@ class ProjectAccessFactory extends Handler<ProjectAccess> {
}
}
+ if (ownerOf.isEmpty() && pc.isOwnerAnyRef()) {
+ // Special case: If the section list is empty, this project has no current
+ // access control information. Rely on what ProjectControl determines
+ // is ownership, which probably means falling back to site administrators.
+ ownerOf.add(AccessSection.ALL);
+ }
+
final ProjectAccess detail = new ProjectAccess();
detail.setRevision(config.getRevision().name());
detail.setLocal(local);