Class PermissionBackend.WithUser
- java.lang.Object
-
- com.google.gerrit.server.permissions.PermissionBackend.AcceptsReviewDb<PermissionBackend.WithUser>
-
- com.google.gerrit.server.permissions.PermissionBackend.WithUser
-
- Enclosing class:
- PermissionBackend
public abstract static class PermissionBackend.WithUser extends PermissionBackend.AcceptsReviewDb<PermissionBackend.WithUser>
PermissionBackend scoped to a specific user.
-
-
Field Summary
-
Fields inherited from class com.google.gerrit.server.permissions.PermissionBackend.AcceptsReviewDb
db
-
-
Constructor Summary
Constructors Constructor Description WithUser()
-
Method Summary
-
Methods inherited from class com.google.gerrit.server.permissions.PermissionBackend.AcceptsReviewDb
database, database
-
-
-
-
Method Detail
-
project
public abstract PermissionBackend.ForProject project(Project.NameKey project)
- Returns:
- instance scoped for the specified project.
-
ref
public PermissionBackend.ForRef ref(Branch.NameKey ref)
- Returns:
- instance scoped for the
ref
, and its parent project.
-
change
public PermissionBackend.ForChange change(ChangeData cd)
- Returns:
- instance scoped for the change, and its destination ref and project.
-
change
public PermissionBackend.ForChange change(ChangeNotes notes)
- Returns:
- instance scoped for the change, and its destination ref and project.
-
indexedChange
public PermissionBackend.ForChange indexedChange(ChangeData cd, ChangeNotes notes)
- Returns:
- instance scoped for the change loaded from index, and its destination ref and project. This method should only be used when database access is harmful and potentially stale data from the index is acceptable.
-
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 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.
-
-