Search in sources :

Example 1 with MemberResource

use of com.google.gerrit.server.group.MemberResource in project gerrit by GerritCodeReview.

the class MembersCollection method parse.

@Override
public MemberResource parse(GroupResource parent, IdString id) throws NotInternalGroupException, AuthException, ResourceNotFoundException, IOException, ConfigInvalidException {
    GroupDescription.Internal group = parent.asInternalGroup().orElseThrow(NotInternalGroupException::new);
    IdentifiedUser user = accounts.parse(TopLevelResource.INSTANCE, id).getUser();
    if (parent.getControl().canSeeMember(user.getAccountId()) && isMember(group, user)) {
        return new MemberResource(parent, user);
    }
    throw new ResourceNotFoundException(id);
}
Also used : GroupDescription(com.google.gerrit.entities.GroupDescription) MemberResource(com.google.gerrit.server.group.MemberResource) IdentifiedUser(com.google.gerrit.server.IdentifiedUser) ResourceNotFoundException(com.google.gerrit.extensions.restapi.ResourceNotFoundException)

Aggregations

GroupDescription (com.google.gerrit.entities.GroupDescription)1 ResourceNotFoundException (com.google.gerrit.extensions.restapi.ResourceNotFoundException)1 IdentifiedUser (com.google.gerrit.server.IdentifiedUser)1 MemberResource (com.google.gerrit.server.group.MemberResource)1