Remove RPC's for listing all groups and my groups

These RPC's are not needed anymore since there is now a REST API to
retrieve the groups.

Change-Id: I92603f4fdc74da1bd7bcf3e55917bb38264f060a
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2013-01-07 14:26:05 +01:00
committed by Gerrit Code Review
parent d57c3fd834
commit 2d7561ddab
7 changed files with 1 additions and 118 deletions

View File

@@ -18,7 +18,6 @@ import com.google.gerrit.common.audit.Audit;
import com.google.gerrit.common.auth.SignInRequired; import com.google.gerrit.common.auth.SignInRequired;
import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.AccountExternalId; import com.google.gerrit.reviewdb.client.AccountExternalId;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.AccountSshKey; import com.google.gerrit.reviewdb.client.AccountSshKey;
import com.google.gerrit.reviewdb.client.ContactInformation; import com.google.gerrit.reviewdb.client.ContactInformation;
import com.google.gwtjsonrpc.common.AsyncCallback; import com.google.gwtjsonrpc.common.AsyncCallback;
@@ -61,9 +60,6 @@ public interface AccountSecurity extends RemoteJsonService {
@SignInRequired @SignInRequired
void myExternalIds(AsyncCallback<List<AccountExternalId>> callback); void myExternalIds(AsyncCallback<List<AccountExternalId>> callback);
@SignInRequired
void myGroups(AsyncCallback<List<AccountGroup>> callback);
@Audit @Audit
@SignInRequired @SignInRequired
void deleteExternalIds(Set<AccountExternalId.Key> keys, void deleteExternalIds(Set<AccountExternalId.Key> keys,

View File

@@ -29,10 +29,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 visibleGroups(AsyncCallback<GroupList> callback);
@Audit @Audit
@SignInRequired @SignInRequired
void createGroup(String newName, AsyncCallback<AccountGroup.Id> callback); void createGroup(String newName, AsyncCallback<AccountGroup.Id> callback);

View File

@@ -34,10 +34,8 @@ public class AccountModule extends RpcServletModule {
factory(DeleteExternalIds.Factory.class); factory(DeleteExternalIds.Factory.class);
factory(ExternalIdDetailFactory.Factory.class); factory(ExternalIdDetailFactory.Factory.class);
factory(GroupDetailHandler.Factory.class); factory(GroupDetailHandler.Factory.class);
factory(MyGroupsFactory.Factory.class);
factory(RegisterNewEmailSender.Factory.class); factory(RegisterNewEmailSender.Factory.class);
factory(RenameGroup.Factory.class); factory(RenameGroup.Factory.class);
factory(VisibleGroupsHandler.Factory.class);
} }
}); });
rpc(AccountSecurityImpl.class); rpc(AccountSecurityImpl.class);

View File

@@ -22,7 +22,6 @@ import com.google.gerrit.common.errors.EmailException;
import com.google.gerrit.common.errors.InvalidSshKeyException; import com.google.gerrit.common.errors.InvalidSshKeyException;
import com.google.gerrit.common.errors.NameAlreadyUsedException; import com.google.gerrit.common.errors.NameAlreadyUsedException;
import com.google.gerrit.common.errors.NoSuchEntityException; import com.google.gerrit.common.errors.NoSuchEntityException;
import com.google.gerrit.common.errors.NoSuchGroupException;
import com.google.gerrit.httpd.rpc.BaseServiceImplementation; import com.google.gerrit.httpd.rpc.BaseServiceImplementation;
import com.google.gerrit.httpd.rpc.Handler; import com.google.gerrit.httpd.rpc.Handler;
import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.Account;
@@ -86,7 +85,6 @@ class AccountSecurityImpl extends BaseServiceImplementation implements
private final ChangeUserName.CurrentUser changeUserNameFactory; private final ChangeUserName.CurrentUser changeUserNameFactory;
private final DeleteExternalIds.Factory deleteExternalIdsFactory; private final DeleteExternalIds.Factory deleteExternalIdsFactory;
private final ExternalIdDetailFactory.Factory externalIdDetailFactory; private final ExternalIdDetailFactory.Factory externalIdDetailFactory;
private final MyGroupsFactory.Factory myGroupsFactory;
private final ChangeHooks hooks; private final ChangeHooks hooks;
private final GroupCache groupCache; private final GroupCache groupCache;
@@ -104,7 +102,6 @@ class AccountSecurityImpl extends BaseServiceImplementation implements
final ChangeUserName.CurrentUser changeUserNameFactory, final ChangeUserName.CurrentUser changeUserNameFactory,
final DeleteExternalIds.Factory deleteExternalIdsFactory, final DeleteExternalIds.Factory deleteExternalIdsFactory,
final ExternalIdDetailFactory.Factory externalIdDetailFactory, final ExternalIdDetailFactory.Factory externalIdDetailFactory,
final MyGroupsFactory.Factory myGroupsFactory,
final ChangeHooks hooks, final GroupCache groupCache) { final ChangeHooks hooks, final GroupCache groupCache) {
super(schema, currentUser); super(schema, currentUser);
contactStore = cs; contactStore = cs;
@@ -126,7 +123,6 @@ class AccountSecurityImpl extends BaseServiceImplementation implements
this.changeUserNameFactory = changeUserNameFactory; this.changeUserNameFactory = changeUserNameFactory;
this.deleteExternalIdsFactory = deleteExternalIdsFactory; this.deleteExternalIdsFactory = deleteExternalIdsFactory;
this.externalIdDetailFactory = externalIdDetailFactory; this.externalIdDetailFactory = externalIdDetailFactory;
this.myGroupsFactory = myGroupsFactory;
this.hooks = hooks; this.hooks = hooks;
this.groupCache = groupCache; this.groupCache = groupCache;
} }
@@ -211,16 +207,6 @@ class AccountSecurityImpl extends BaseServiceImplementation implements
externalIdDetailFactory.create().to(callback); externalIdDetailFactory.create().to(callback);
} }
@Override
public void myGroups(final AsyncCallback<List<AccountGroup>> callback) {
run(callback, new Action<List<AccountGroup>>() {
public List<AccountGroup> run(final ReviewDb db) throws OrmException,
NoSuchGroupException, Failure {
return myGroupsFactory.create().call();
}
});
}
public void deleteExternalIds(final Set<AccountExternalId.Key> keys, public void deleteExternalIds(final Set<AccountExternalId.Key> keys,
final AsyncCallback<Set<AccountExternalId.Key>> callback) { final AsyncCallback<Set<AccountExternalId.Key>> callback) {
deleteExternalIdsFactory.create(keys).to(callback); deleteExternalIdsFactory.create(keys).to(callback);

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.httpd.rpc.account;
import com.google.gerrit.common.data.GroupAdminService; import com.google.gerrit.common.data.GroupAdminService;
import com.google.gerrit.common.data.GroupDetail; import com.google.gerrit.common.data.GroupDetail;
import com.google.gerrit.common.data.GroupList;
import com.google.gerrit.common.data.GroupOptions; import com.google.gerrit.common.data.GroupOptions;
import com.google.gerrit.common.data.GroupReference; import com.google.gerrit.common.data.GroupReference;
import com.google.gerrit.common.errors.InactiveAccountException; import com.google.gerrit.common.errors.InactiveAccountException;
@@ -69,7 +68,6 @@ class GroupAdminServiceImpl extends BaseServiceImplementation implements
private final CreateGroup.Factory createGroupFactory; 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;
private final VisibleGroupsHandler.Factory visibleGroupsFactory;
@Inject @Inject
GroupAdminServiceImpl(final Provider<ReviewDb> schema, GroupAdminServiceImpl(final Provider<ReviewDb> schema,
@@ -84,8 +82,7 @@ class GroupAdminServiceImpl extends BaseServiceImplementation implements
final GroupControl.Factory groupControlFactory, final GroupControl.Factory groupControlFactory,
final CreateGroup.Factory createGroupFactory, final CreateGroup.Factory createGroupFactory,
final RenameGroup.Factory renameGroupFactory, final RenameGroup.Factory renameGroupFactory,
final GroupDetailHandler.Factory groupDetailFactory, final GroupDetailHandler.Factory groupDetailFactory) {
final VisibleGroupsHandler.Factory visibleGroupsFactory) {
super(schema, currentUser); super(schema, currentUser);
this.accountCache = accountCache; this.accountCache = accountCache;
this.groupIncludeCache = groupIncludeCache; this.groupIncludeCache = groupIncludeCache;
@@ -98,11 +95,6 @@ class GroupAdminServiceImpl extends BaseServiceImplementation implements
this.createGroupFactory = createGroupFactory; this.createGroupFactory = createGroupFactory;
this.renameGroupFactory = renameGroupFactory; this.renameGroupFactory = renameGroupFactory;
this.groupDetailFactory = groupDetailFactory; this.groupDetailFactory = groupDetailFactory;
this.visibleGroupsFactory = visibleGroupsFactory;
}
public void visibleGroups(final AsyncCallback<GroupList> callback) {
visibleGroupsFactory.create().to(callback);
} }
public void createGroup(final String newName, public void createGroup(final String newName,

View File

@@ -1,46 +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.NoSuchGroupException;
import com.google.gerrit.httpd.rpc.Handler;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.VisibleGroups;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import java.util.List;
class MyGroupsFactory extends Handler<List<AccountGroup>> {
interface Factory {
MyGroupsFactory create();
}
private final VisibleGroups.Factory visibleGroupsFactory;
private final IdentifiedUser user;
@Inject
MyGroupsFactory(final VisibleGroups.Factory visibleGroupsFactory, final IdentifiedUser user) {
this.visibleGroupsFactory = visibleGroupsFactory;
this.user = user;
}
@Override
public List<AccountGroup> call() throws OrmException, NoSuchGroupException {
final VisibleGroups visibleGroups = visibleGroupsFactory.create();
return visibleGroups.get(user).getGroups();
}
}

View File

@@ -1,39 +0,0 @@
// Copyright (C) 2011 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.data.GroupList;
import com.google.gerrit.httpd.rpc.Handler;
import com.google.gerrit.server.account.VisibleGroups;
import com.google.inject.Inject;
public class VisibleGroupsHandler extends Handler<GroupList> {
interface Factory {
VisibleGroupsHandler create();
}
private final VisibleGroups.Factory visibleGroupsFactory;
@Inject
VisibleGroupsHandler(final VisibleGroups.Factory visibleGroupsFactory) {
this.visibleGroupsFactory = visibleGroupsFactory;
}
@Override
public GroupList call() throws Exception {
return visibleGroupsFactory.create().get();
}
}