Search in sources :

Example 26 with NoSuchGroupException

use of com.google.gerrit.exceptions.NoSuchGroupException in project gerrit by GerritCodeReview.

the class CreateAccount method addGroupMember.

private void addGroupMember(AccountGroup.UUID groupUuid, Account.Id accountId) throws IOException, NoSuchGroupException, ConfigInvalidException {
    GroupDelta groupDelta = GroupDelta.builder().setMemberModification(memberIds -> Sets.union(memberIds, ImmutableSet.of(accountId))).build();
    groupsUpdate.get().updateGroup(groupUuid, groupDelta);
}
Also used : GlobalCapability(com.google.gerrit.common.data.GlobalCapability) GroupResolver(com.google.gerrit.server.group.GroupResolver) RequiresCapability(com.google.gerrit.extensions.annotations.RequiresCapability) Inject(com.google.inject.Inject) BadRequestException(com.google.gerrit.extensions.restapi.BadRequestException) GroupsUpdate(com.google.gerrit.server.group.db.GroupsUpdate) AccountExternalIdCreator(com.google.gerrit.server.account.AccountExternalIdCreator) AccountInfo(com.google.gerrit.extensions.common.AccountInfo) SCHEME_USERNAME(com.google.gerrit.server.account.externalids.ExternalId.SCHEME_USERNAME) Locale(java.util.Locale) ImmutableSet(com.google.common.collect.ImmutableSet) SshKeyCache(com.google.gerrit.server.ssh.SshKeyCache) Account(com.google.gerrit.entities.Account) Set(java.util.Set) Sets(com.google.common.collect.Sets) TopLevelResource(com.google.gerrit.extensions.restapi.TopLevelResource) List(java.util.List) Nullable(com.google.gerrit.common.Nullable) UserInitiated(com.google.gerrit.server.UserInitiated) PluginSetContext(com.google.gerrit.server.plugincontext.PluginSetContext) AuthConfig(com.google.gerrit.server.config.AuthConfig) Singleton(com.google.inject.Singleton) VersionedAuthorizedKeys(com.google.gerrit.server.account.VersionedAuthorizedKeys) AccountLoader(com.google.gerrit.server.account.AccountLoader) PermissionBackendException(com.google.gerrit.server.permissions.PermissionBackendException) ConfigInvalidException(org.eclipse.jgit.errors.ConfigInvalidException) NoSuchGroupException(com.google.gerrit.exceptions.NoSuchGroupException) IdString(com.google.gerrit.extensions.restapi.IdString) UnprocessableEntityException(com.google.gerrit.extensions.restapi.UnprocessableEntityException) Response(com.google.gerrit.extensions.restapi.Response) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) AccountInput(com.google.gerrit.extensions.api.accounts.AccountInput) GroupDescription(com.google.gerrit.entities.GroupDescription) RestCollectionCreateView(com.google.gerrit.extensions.restapi.RestCollectionCreateView) ExternalIdFactory(com.google.gerrit.server.account.externalids.ExternalIdFactory) AccountsUpdate(com.google.gerrit.server.account.AccountsUpdate) AccountGroup(com.google.gerrit.entities.AccountGroup) OutgoingEmailValidator(com.google.gerrit.server.mail.send.OutgoingEmailValidator) Sequences(com.google.gerrit.server.notedb.Sequences) AccountResource(com.google.gerrit.server.account.AccountResource) IOException(java.io.IOException) SCHEME_MAILTO(com.google.gerrit.server.account.externalids.ExternalId.SCHEME_MAILTO) InvalidSshKeyException(com.google.gerrit.exceptions.InvalidSshKeyException) Provider(com.google.inject.Provider) ResourceConflictException(com.google.gerrit.extensions.restapi.ResourceConflictException) ExternalId(com.google.gerrit.server.account.externalids.ExternalId) DuplicateExternalIdKeyException(com.google.gerrit.server.account.externalids.DuplicateExternalIdKeyException) GroupDelta(com.google.gerrit.server.group.db.GroupDelta) GroupDelta(com.google.gerrit.server.group.db.GroupDelta)

Aggregations

NoSuchGroupException (com.google.gerrit.exceptions.NoSuchGroupException)26 AccountGroup (com.google.gerrit.entities.AccountGroup)22 GroupDescription (com.google.gerrit.entities.GroupDescription)13 AuthException (com.google.gerrit.extensions.restapi.AuthException)12 ResourceNotFoundException (com.google.gerrit.extensions.restapi.ResourceNotFoundException)12 GroupControl (com.google.gerrit.server.account.GroupControl)12 GroupDelta (com.google.gerrit.server.group.db.GroupDelta)12 Account (com.google.gerrit.entities.Account)10 ArrayList (java.util.ArrayList)10 Inject (com.google.inject.Inject)9 IOException (java.io.IOException)9 Singleton (com.google.inject.Singleton)8 Sets (com.google.common.collect.Sets)7 UnprocessableEntityException (com.google.gerrit.extensions.restapi.UnprocessableEntityException)7 ExternalId (com.google.gerrit.server.account.externalids.ExternalId)7 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)6 IdString (com.google.gerrit.extensions.restapi.IdString)6 Response (com.google.gerrit.extensions.restapi.Response)6 GroupResource (com.google.gerrit.server.group.GroupResource)6 GroupsUpdate (com.google.gerrit.server.group.db.GroupsUpdate)6