Search in sources :

Example 1 with Capability

use of com.google.gerrit.server.account.AccountResource.Capability in project gerrit by GerritCodeReview.

the class Capabilities method parse.

@Override
public Capability parse(AccountResource parent, IdString id) throws ResourceNotFoundException, AuthException, PermissionBackendException {
    IdentifiedUser target = parent.getUser();
    if (self.get() != target) {
        permissionBackend.user(self).check(GlobalPermission.ADMINISTRATE_SERVER);
    }
    GlobalOrPluginPermission perm = parse(id);
    if (permissionBackend.user(target).test(perm)) {
        return new AccountResource.Capability(target, perm.permissionName());
    }
    throw new ResourceNotFoundException(id);
}
Also used : Capability(com.google.gerrit.server.account.AccountResource.Capability) IdentifiedUser(com.google.gerrit.server.IdentifiedUser) ResourceNotFoundException(com.google.gerrit.extensions.restapi.ResourceNotFoundException) GlobalOrPluginPermission(com.google.gerrit.extensions.api.access.GlobalOrPluginPermission)

Aggregations

GlobalOrPluginPermission (com.google.gerrit.extensions.api.access.GlobalOrPluginPermission)1 ResourceNotFoundException (com.google.gerrit.extensions.restapi.ResourceNotFoundException)1 IdentifiedUser (com.google.gerrit.server.IdentifiedUser)1 Capability (com.google.gerrit.server.account.AccountResource.Capability)1