public abstract static class PermissionBackend.WithUser
extends java.lang.Object
Constructor and Description |
---|
WithUser() |
Modifier and Type | Method and Description |
---|---|
PermissionBackend.ForChange |
change(ChangeData cd)
Returns an instance scoped for the change, and its destination ref and project.
|
PermissionBackend.ForChange |
change(ChangeNotes notes)
Returns an instance scoped for the change, and its destination ref and project.
|
abstract void |
check(GlobalOrPluginPermission perm)
Verify scoped user can
perm , throwing if denied. |
void |
checkAny(java.util.Set<GlobalOrPluginPermission> any)
Verify scoped user can perform at least one listed permission.
|
java.util.Set<Project.NameKey> |
filter(ProjectPermission perm,
java.util.Collection<Project.NameKey> projects)
Filter a set of projects using
check(perm) . |
PermissionBackend.ForChange |
indexedChange(ChangeData cd,
ChangeNotes notes)
Returns an instance scoped for the change loaded from index, and its destination ref and
project.
|
abstract PermissionBackend.ForProject |
project(Project.NameKey project)
Returns an instance scoped for the specified project.
|
PermissionBackend.ForRef |
ref(Branch.NameKey ref)
Returns an instance scoped for the
ref , and its parent project. |
abstract <T extends GlobalOrPluginPermission> |
test(java.util.Collection<T> permSet)
Filter
permSet to permissions scoped user might be able to perform. |
boolean |
test(GlobalOrPluginPermission perm) |
abstract BooleanCondition |
testCond(GlobalOrPluginPermission perm) |
boolean |
testOrFalse(GlobalOrPluginPermission perm) |
public abstract PermissionBackend.ForProject project(Project.NameKey project)
public PermissionBackend.ForRef ref(Branch.NameKey ref)
ref
, and its parent project.public PermissionBackend.ForChange change(ChangeData cd)
public PermissionBackend.ForChange change(ChangeNotes notes)
public PermissionBackend.ForChange indexedChange(ChangeData cd, ChangeNotes notes)
public abstract void check(GlobalOrPluginPermission perm) throws AuthException, PermissionBackendException
perm
, throwing if denied.public void checkAny(java.util.Set<GlobalOrPluginPermission> any) throws PermissionBackendException, AuthException
If any
is empty, the method completes normally and allows the caller to continue.
Since no permissions were supplied to check, its assumed no permissions are necessary to
continue with the caller's operation.
If the user has at least one of the permissions in any
, the method completes
normally, possibly without checking all listed permissions.
If any
is non-empty and the user has none, AuthException
is thrown for one
of the failed permissions.
any
- set of permissions to check.PermissionBackendException
AuthException
public abstract <T extends GlobalOrPluginPermission> java.util.Set<T> test(java.util.Collection<T> permSet) throws PermissionBackendException
permSet
to permissions scoped user might be able to perform.PermissionBackendException
public boolean test(GlobalOrPluginPermission perm) throws PermissionBackendException
PermissionBackendException
public boolean testOrFalse(GlobalOrPluginPermission perm)
public abstract BooleanCondition testCond(GlobalOrPluginPermission perm)
public java.util.Set<Project.NameKey> filter(ProjectPermission perm, java.util.Collection<Project.NameKey> projects) throws PermissionBackendException
check(perm)
.perm
- required permission in a project to be included in result.projects
- candidate set of projects; may be empty.projects
where check(perm)
was successful.PermissionBackendException
- backend cannot access its internal state.