Class PermissionBackend.WithUser
- java.lang.Object
-
- com.google.gerrit.server.permissions.PermissionBackend.WithUser
-
- Enclosing class:
- PermissionBackend
public abstract static class PermissionBackend.WithUser extends Object
PermissionBackend scoped to a specific user.
-
-
Constructor Summary
Constructors Constructor Description WithUser()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description PermissionBackend.ForChange
change(ChangeNotes notes)
Returns an instance scoped for the change, and its destination ref and project.PermissionBackend.ForChange
change(ChangeData cd)
Returns an instance scoped for the change, and its destination ref and project.abstract void
check(GlobalOrPluginPermission perm)
Verify scoped user canperm
, throwing if denied.void
checkAny(Set<GlobalOrPluginPermission> any)
Verify scoped user can perform at least one listed permission.Set<Project.NameKey>
filter(ProjectPermission perm, Collection<Project.NameKey> projects)
Filter a set of projects usingcheck(perm)
.abstract PermissionBackend.ForProject
project(Project.NameKey project)
Returns an instance scoped for the specified project.PermissionBackend.ForRef
ref(BranchNameKey ref)
Returns an instance scoped for theref
, and its parent project.boolean
test(GlobalOrPluginPermission perm)
abstract <T extends GlobalOrPluginPermission>
Set<T>test(Collection<T> permSet)
FilterpermSet
to permissions scoped user might be able to perform.abstract BooleanCondition
testCond(GlobalOrPluginPermission perm)
boolean
testOrFalse(GlobalOrPluginPermission perm)
-
-
-
Method Detail
-
project
public abstract PermissionBackend.ForProject project(Project.NameKey project)
Returns an instance scoped for the specified project.
-
ref
public PermissionBackend.ForRef ref(BranchNameKey ref)
Returns an instance scoped for theref
, and its parent project.
-
change
public PermissionBackend.ForChange change(ChangeData cd)
Returns an instance scoped for the change, and its destination ref and project.
-
change
public PermissionBackend.ForChange change(ChangeNotes notes)
Returns an instance scoped for the change, and its destination ref and project.
-
check
public abstract void check(GlobalOrPluginPermission perm) throws AuthException, PermissionBackendException
Verify scoped user canperm
, throwing if denied.
-
checkAny
public void checkAny(Set<GlobalOrPluginPermission> any) throws PermissionBackendException, AuthException
Verify scoped user can perform at least one listed permission.If
any
is empty, the method completes normally and allows the caller to continue. Since no permissions were supplied to check, its assumed no permissions are necessary to continue with the caller's operation.If the user has at least one of the permissions in
any
, the method completes normally, possibly without checking all listed permissions.If
any
is non-empty and the user has none,AuthException
is thrown for one of the failed permissions.- Parameters:
any
- set of permissions to check.- Throws:
PermissionBackendException
AuthException
-
test
public abstract <T extends GlobalOrPluginPermission> Set<T> test(Collection<T> permSet) throws PermissionBackendException
FilterpermSet
to permissions scoped user might be able to perform.- Throws:
PermissionBackendException
-
test
public boolean test(GlobalOrPluginPermission perm) throws PermissionBackendException
- Throws:
PermissionBackendException
-
testOrFalse
public boolean testOrFalse(GlobalOrPluginPermission perm)
-
testCond
public abstract BooleanCondition testCond(GlobalOrPluginPermission perm)
-
filter
public Set<Project.NameKey> filter(ProjectPermission perm, Collection<Project.NameKey> projects) throws PermissionBackendException
Filter a set of projects usingcheck(perm)
.- Parameters:
perm
- required permission in a project to be included in result.projects
- candidate set of projects; may be empty.- Returns:
- filtered set of
projects
wherecheck(perm)
was successful. - Throws:
PermissionBackendException
- backend cannot access its internal state.
-
-