Class PermissionBackend.ForChange
- java.lang.Object
-
- com.google.gerrit.server.permissions.PermissionBackend.AcceptsReviewDb<PermissionBackend.ForChange>
-
- com.google.gerrit.server.permissions.PermissionBackend.ForChange
-
- Enclosing class:
- PermissionBackend
public abstract static class PermissionBackend.ForChange extends PermissionBackend.AcceptsReviewDb<PermissionBackend.ForChange>
PermissionBackend scoped to a user, project, reference and change.
-
-
Field Summary
-
Fields inherited from class com.google.gerrit.server.permissions.PermissionBackend.AcceptsReviewDb
db
-
-
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.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.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.abstract CurrentUser
user()
abstract PermissionBackend.ForChange
user(CurrentUser user)
-
Methods inherited from class com.google.gerrit.server.permissions.PermissionBackend.AcceptsReviewDb
database, database
-
-
-
-
Method Detail
-
user
public abstract CurrentUser user()
- Returns:
- user this instance is scoped to.
-
user
public abstract PermissionBackend.ForChange user(CurrentUser user)
- Returns:
- new instance rescoped to same change, but different
user
.
-
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 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.
-
-