Remove old RPC to create groups
The RPC for deleting groups is not used anymore. This functionality is now covered by the REST API. Change-Id: I8c796aa5c8afdd7cbf045d32dff2adc6579fd330 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -28,10 +28,6 @@ import java.util.Set;
|
|||||||
|
|
||||||
@RpcImpl(version = Version.V2_0)
|
@RpcImpl(version = Version.V2_0)
|
||||||
public interface GroupAdminService extends RemoteJsonService {
|
public interface GroupAdminService extends RemoteJsonService {
|
||||||
@Audit
|
|
||||||
@SignInRequired
|
|
||||||
void createGroup(String newName, AsyncCallback<AccountGroup.Id> callback);
|
|
||||||
|
|
||||||
@Audit
|
@Audit
|
||||||
@SignInRequired
|
@SignInRequired
|
||||||
void groupDetail(AccountGroup.Id groupId, AccountGroup.UUID uuid,
|
void groupDetail(AccountGroup.Id groupId, AccountGroup.UUID uuid,
|
||||||
|
@@ -30,7 +30,6 @@ public class AccountModule extends RpcServletModule {
|
|||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
factory(AgreementInfoFactory.Factory.class);
|
factory(AgreementInfoFactory.Factory.class);
|
||||||
factory(CreateGroup.Factory.class);
|
|
||||||
factory(DeleteExternalIds.Factory.class);
|
factory(DeleteExternalIds.Factory.class);
|
||||||
factory(ExternalIdDetailFactory.Factory.class);
|
factory(ExternalIdDetailFactory.Factory.class);
|
||||||
factory(GroupDetailHandler.Factory.class);
|
factory(GroupDetailHandler.Factory.class);
|
||||||
|
@@ -1,61 +0,0 @@
|
|||||||
// Copyright (C) 2009 The Android Open Source Project
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package com.google.gerrit.httpd.rpc.account;
|
|
||||||
|
|
||||||
import com.google.gerrit.common.errors.NameAlreadyUsedException;
|
|
||||||
import com.google.gerrit.common.errors.PermissionDeniedException;
|
|
||||||
import com.google.gerrit.httpd.rpc.Handler;
|
|
||||||
import com.google.gerrit.reviewdb.client.Account;
|
|
||||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
|
||||||
import com.google.gerrit.server.IdentifiedUser;
|
|
||||||
import com.google.gerrit.server.account.PerformCreateGroup;
|
|
||||||
import com.google.gerrit.server.config.GerritServerConfig;
|
|
||||||
import com.google.gwtorm.server.OrmException;
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
import com.google.inject.assistedinject.Assisted;
|
|
||||||
|
|
||||||
import org.eclipse.jgit.lib.Config;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
class CreateGroup extends Handler<AccountGroup.Id> {
|
|
||||||
interface Factory {
|
|
||||||
CreateGroup create(String groupName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final PerformCreateGroup.Factory performCreateGroupFactory;
|
|
||||||
private final IdentifiedUser user;
|
|
||||||
private final boolean visibleToAll;
|
|
||||||
private final String groupName;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
CreateGroup(final PerformCreateGroup.Factory performCreateGroupFactory,
|
|
||||||
final IdentifiedUser user, @GerritServerConfig final Config cfg,
|
|
||||||
@Assisted final String groupName) {
|
|
||||||
this.performCreateGroupFactory = performCreateGroupFactory;
|
|
||||||
this.user = user;
|
|
||||||
this.visibleToAll = cfg.getBoolean("groups", "newGroupsVisibleToAll", false);
|
|
||||||
this.groupName = groupName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AccountGroup.Id call() throws OrmException, NameAlreadyUsedException,
|
|
||||||
PermissionDeniedException {
|
|
||||||
final PerformCreateGroup performCreateGroup = performCreateGroupFactory.create();
|
|
||||||
final Account.Id me = user.getAccountId();
|
|
||||||
return performCreateGroup.createGroup(groupName, null, visibleToAll, null,
|
|
||||||
Collections.singleton(me), null).getId();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -50,7 +50,6 @@ class GroupAdminServiceImpl extends BaseServiceImplementation implements
|
|||||||
private final GroupIncludeCache groupIncludeCache;
|
private final GroupIncludeCache groupIncludeCache;
|
||||||
private final GroupControl.Factory groupControlFactory;
|
private final GroupControl.Factory groupControlFactory;
|
||||||
|
|
||||||
private final CreateGroup.Factory createGroupFactory;
|
|
||||||
private final RenameGroup.Factory renameGroupFactory;
|
private final RenameGroup.Factory renameGroupFactory;
|
||||||
private final GroupDetailHandler.Factory groupDetailFactory;
|
private final GroupDetailHandler.Factory groupDetailFactory;
|
||||||
|
|
||||||
@@ -61,7 +60,6 @@ class GroupAdminServiceImpl extends BaseServiceImplementation implements
|
|||||||
final GroupCache groupCache,
|
final GroupCache groupCache,
|
||||||
final GroupBackend groupBackend,
|
final GroupBackend groupBackend,
|
||||||
final GroupControl.Factory groupControlFactory,
|
final GroupControl.Factory groupControlFactory,
|
||||||
final CreateGroup.Factory createGroupFactory,
|
|
||||||
final RenameGroup.Factory renameGroupFactory,
|
final RenameGroup.Factory renameGroupFactory,
|
||||||
final GroupDetailHandler.Factory groupDetailFactory) {
|
final GroupDetailHandler.Factory groupDetailFactory) {
|
||||||
super(schema, currentUser);
|
super(schema, currentUser);
|
||||||
@@ -69,16 +67,10 @@ class GroupAdminServiceImpl extends BaseServiceImplementation implements
|
|||||||
this.groupCache = groupCache;
|
this.groupCache = groupCache;
|
||||||
this.groupBackend = groupBackend;
|
this.groupBackend = groupBackend;
|
||||||
this.groupControlFactory = groupControlFactory;
|
this.groupControlFactory = groupControlFactory;
|
||||||
this.createGroupFactory = createGroupFactory;
|
|
||||||
this.renameGroupFactory = renameGroupFactory;
|
this.renameGroupFactory = renameGroupFactory;
|
||||||
this.groupDetailFactory = groupDetailFactory;
|
this.groupDetailFactory = groupDetailFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createGroup(final String newName,
|
|
||||||
final AsyncCallback<AccountGroup.Id> callback) {
|
|
||||||
createGroupFactory.create(newName).to(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void groupDetail(AccountGroup.Id groupId, AccountGroup.UUID groupUUID,
|
public void groupDetail(AccountGroup.Id groupId, AccountGroup.UUID groupUUID,
|
||||||
AsyncCallback<GroupDetail> callback) {
|
AsyncCallback<GroupDetail> callback) {
|
||||||
if (groupId == null && groupUUID != null) {
|
if (groupId == null && groupUUID != null) {
|
||||||
|
Reference in New Issue
Block a user