Class PermissionBackend.ForChange
java.lang.Object
com.google.gerrit.server.permissions.PermissionBackend.ForChange
- Enclosing class:
- PermissionBackend
PermissionBackend scoped to a user, project, reference and change.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
check
(ChangePermissionOrLabel perm) Verify scoped user canperm
, throwing if denied.abstract String
Returns the 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
(ChangePermissionOrLabel perm) abstract <T extends ChangePermissionOrLabel>
Set<T>test
(Collection<T> permSet) FilterpermSet
to permissions scoped user might be able to perform.abstract BooleanCondition
testLabelRemovals
(Collection<LabelType> types) Test which values of a group of labels the user may be able to remove.testLabels
(Collection<LabelType> types) Test which values of a group of labels the user may be able to set.boolean
Test if user may be able to perform the permission.testRemoval
(LabelType label) Test which values of a label the user may be able to remove.
-
Constructor Details
-
ForChange
public ForChange()
-
-
Method Details
-
resourcePath
Returns the fully qualified resource path that this instance is scoped to. -
check
public abstract void check(ChangePermissionOrLabel 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(ChangePermissionOrLabel)
. -
test
public abstract <T extends ChangePermissionOrLabel> Set<T> test(Collection<T> permSet) throws PermissionBackendException FilterpermSet
to permissions scoped user might be able to perform.- Throws:
PermissionBackendException
-
test
- Throws:
PermissionBackendException
-
testOrFalse
Test if user may be able to perform the permission.Similar to
test(ChangePermissionOrLabel)
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
-
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.
-
testRemoval
public Set<LabelRemovalPermission.WithValue> testRemoval(LabelType label) throws PermissionBackendException Test which values of a label the user may be able to remove.- 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.
-
testLabels
public Set<LabelPermission.WithValue> testLabels(Collection<LabelType> types) throws PermissionBackendException Test which values of a group of labels the user may be able to set.- Parameters:
types
- definition of the labels 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.
-
testLabelRemovals
public Set<LabelRemovalPermission.WithValue> testLabelRemovals(Collection<LabelType> types) throws PermissionBackendException Test which values of a group of labels the user may be able to remove.- Parameters:
types
- definition of the labels 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.
-