Merge "Support to check via REST if a group is owned by the calling user"

This commit is contained in:
Shawn Pearce
2013-02-08 16:28:10 +00:00
committed by Gerrit Code Review
7 changed files with 153 additions and 28 deletions

View File

@@ -23,9 +23,31 @@ import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.IdentifiedUser;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
/** Access control management for a group of accounts managed in Gerrit. */
public class GroupControl {
@Singleton
public static class GenericFactory {
private final GroupBackend groupBackend;
@Inject
GenericFactory(final GroupBackend gb) {
groupBackend = gb;
}
public GroupControl controlFor(final CurrentUser who,
final AccountGroup.UUID groupId)
throws NoSuchGroupException {
final GroupDescription.Basic group = groupBackend.get(groupId);
if (group == null) {
throw new NoSuchGroupException(groupId);
}
return new GroupControl(who, group);
}
}
public static class Factory {
private final GroupCache groupCache;
private final Provider<CurrentUser> user;