Block off commands on a server for certain user groups.

This feature adds two new options to gerrit.config file: upload and
receive with the allowGroup attribute, that restrict to some specific
groups the ability to run upload/receive commands on the server.

[sp: All bugs are mine, I refactored the code a bit from the original]

Change-Id: Ibd31bd11234e429f8b0201bbb03099f737281f21
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
lincoln
2010-07-05 10:53:25 -03:00
committed by Shawn O. Pearce
parent cfe5c6b49c
commit 2be1160f05
18 changed files with 416 additions and 78 deletions

View File

@@ -40,6 +40,7 @@ public class ProjectState {
private final AnonymousUser anonymousUser;
private final Project.NameKey wildProject;
private final ProjectCache projectCache;
private final ProjectControl.AssistedFactory projectControlFactory;
private final Project project;
private final Collection<RefRight> localRights;
@@ -51,11 +52,13 @@ public class ProjectState {
protected ProjectState(final AnonymousUser anonymousUser,
final ProjectCache projectCache,
@WildProjectName final Project.NameKey wildProject,
final ProjectControl.AssistedFactory projectControlFactory,
@Assisted final Project project,
@Assisted final Collection<RefRight> rights) {
this.anonymousUser = anonymousUser;
this.projectCache = projectCache;
this.wildProject = wildProject;
this.projectControlFactory = projectControlFactory;
this.project = project;
this.localRights = rights;
@@ -160,7 +163,7 @@ public class ProjectState {
}
public ProjectControl controlFor(final CurrentUser user) {
return new ProjectControl(user, this);
return projectControlFactory.create(user, this);
}
private static Collection<RefRight> filter(Collection<RefRight> all,