Class PermissionBackend.ForRef
java.lang.Object
com.google.gerrit.server.permissions.PermissionBackend.ForRef
- Enclosing class:
PermissionBackend
PermissionBackend scoped to a user, project and reference.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract PermissionBackend.ForChange
change
(ChangeNotes notes) Returns an instance scoped to change.abstract PermissionBackend.ForChange
change
(ChangeData cd) Returns an instance scoped to change.abstract void
check
(RefPermissionOrLabel perm) Verify scoped user canperm
, throwing if denied.abstract String
Returns a fully qualified resource path that this instance is scoped to.Test which values of a label the user may be able to set.boolean
test
(RefPermissionOrLabel perm) abstract <T extends RefPermissionOrLabel>
Set<T> test
(Collection<T> permSet) FilterpermSet
to permissions scoped user might be able to perform.abstract BooleanCondition
testCond
(RefPermissionOrLabel perm) boolean
Test if user may be able to perform the permission.
-
Constructor Details
-
ForRef
public ForRef()
-
-
Method Details
-
resourcePath
Returns a fully qualified resource path that this instance is scoped to. -
change
Returns an instance scoped to change. -
change
Returns an instance scoped to change. -
check
public abstract void check(RefPermissionOrLabel perm) throws AuthException, PermissionBackendException Verify scoped user canperm
, throwing if denied.Should be used in REST API handlers where the thrown
AuthException
can be propagated. In business logic, where the exception would have to be caught, prefer usingtest(RefPermissionOrLabel)
. -
test
public abstract <T extends RefPermissionOrLabel> Set<T> test(Collection<T> permSet) throws PermissionBackendException FilterpermSet
to permissions scoped user might be able to perform.- Throws:
PermissionBackendException
-
test
- Throws:
PermissionBackendException
-
test
Test which values of a label the user may be able to set.- Parameters:
label
- definition of the label to test values of.- Returns:
- set containing values the user may be able to use; may be empty if none.
- Throws:
PermissionBackendException
- if failure consulting backend configuration.
-
testOrFalse
Test if user may be able to perform the permission.Similar to
test(RefPermission)
except this method returnsfalse
instead of throwing an exception.- Parameters:
perm
- the permission to test.- Returns:
- true if the user might be able to perform the permission; false if the user may be missing the necessary grants or state, or if the backend threw an exception.
-
testCond
-