Class PermissionBackend.ForChange
- java.lang.Object
-
- com.google.gerrit.server.permissions.PermissionBackend.ForChange
-
- Enclosing class:
- PermissionBackend
public abstract static class PermissionBackend.ForChange extends Object
PermissionBackend scoped to a user, project, reference and change.
-
-
Constructor Summary
Constructors Constructor Description ForChange()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
check(ChangePermissionOrLabel perm)
Verify scoped user canperm
, throwing if denied.abstract String
resourcePath()
Returns the fully qualified resource path that this instance is scoped to.Set<LabelPermission.WithValue>
test(LabelType label)
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
testCond(ChangePermissionOrLabel perm)
Set<LabelPermission.WithValue>
testLabels(Collection<LabelType> types)
Test which values of a group of labels the user may be able to set.boolean
testOrFalse(ChangePermissionOrLabel perm)
Test if user may be able to perform the permission.
-
-
-
Method Detail
-
resourcePath
public abstract String 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.
-
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
public boolean test(ChangePermissionOrLabel perm) throws PermissionBackendException
- Throws:
PermissionBackendException
-
testOrFalse
public boolean testOrFalse(ChangePermissionOrLabel perm)
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
public abstract BooleanCondition testCond(ChangePermissionOrLabel perm)
-
test
public Set<LabelPermission.WithValue> test(LabelType label) throws PermissionBackendException
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.
-
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.
-
-