Class PermissionBackend.ForRef
- java.lang.Object
-
- com.google.gerrit.server.permissions.PermissionBackend.ForRef
-
- Enclosing class:
- PermissionBackend
public abstract static class PermissionBackend.ForRef extends Object
PermissionBackend scoped to a user, project and reference.
-
-
Constructor Summary
Constructors Constructor Description ForRef()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract 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(RefPermission perm)
Verify scoped user canperm
, throwing if denied.abstract String
resourcePath()
Returns a fully qualified resource path that this instance is scoped to.boolean
test(RefPermission perm)
abstract Set<RefPermission>
test(Collection<RefPermission> permSet)
FilterpermSet
to permissions scoped user might be able to perform.abstract BooleanCondition
testCond(RefPermission perm)
boolean
testOrFalse(RefPermission perm)
Test if user may be able to perform the permission.
-
-
-
Method Detail
-
resourcePath
public abstract String resourcePath()
Returns a fully qualified resource path that this instance is scoped to.
-
change
public abstract PermissionBackend.ForChange change(ChangeData cd)
Returns an instance scoped to change.
-
change
public abstract PermissionBackend.ForChange change(ChangeNotes notes)
Returns an instance scoped to change.
-
check
public abstract void check(RefPermission 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(RefPermission)
.
-
test
public abstract Set<RefPermission> test(Collection<RefPermission> permSet) throws PermissionBackendException
FilterpermSet
to permissions scoped user might be able to perform.- Throws:
PermissionBackendException
-
test
public boolean test(RefPermission perm) throws PermissionBackendException
- Throws:
PermissionBackendException
-
testOrFalse
public boolean testOrFalse(RefPermission perm)
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
public abstract BooleanCondition testCond(RefPermission perm)
-
-