Class PermissionBackend.ForProject
java.lang.Object
com.google.gerrit.server.permissions.PermissionBackend.ForProject
- Enclosing class:
PermissionBackend
PermissionBackend scoped to a user and project.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchange
(ChangeNotes notes) Returns an instance scoped for the change, and its destination ref and project.change
(ChangeData cd) Returns an instance scoped for the change, and its destination ref and project.abstract void
Verify scoped user canperm
, throwing if denied.abstract Collection
<org.eclipse.jgit.lib.Ref> filter
(Collection<org.eclipse.jgit.lib.Ref> refs, org.eclipse.jgit.lib.Repository repo, PermissionBackend.RefFilterOptions opts) Filter a list of references by visibility.abstract PermissionBackend.ForRef
Returns an instance scoped forref
in this project.abstract String
Returns the fully qualified resource path that this instance is scoped to.boolean
abstract <T extends CoreOrPluginProjectPermission>
Set<T> test
(Collection<T> permSet) FilterpermSet
to permissions scoped user might be able to perform.abstract BooleanCondition
boolean
-
Constructor Details
-
ForProject
public ForProject()
-
-
Method Details
-
resourcePath
Returns the fully qualified resource path that this instance is scoped to. -
ref
Returns an instance scoped forref
in this project. -
change
Returns an instance scoped for the change, and its destination ref and project. -
change
Returns an instance scoped for the change, and its destination ref and project. -
check
public abstract void check(CoreOrPluginProjectPermission 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(CoreOrPluginProjectPermission)
. -
test
public abstract <T extends CoreOrPluginProjectPermission> Set<T> test(Collection<T> permSet) throws PermissionBackendException FilterpermSet
to permissions scoped user might be able to perform.- Throws:
PermissionBackendException
-
test
- Throws:
PermissionBackendException
-
testOrFalse
-
testCond
-
filter
public abstract Collection<org.eclipse.jgit.lib.Ref> filter(Collection<org.eclipse.jgit.lib.Ref> refs, org.eclipse.jgit.lib.Repository repo, PermissionBackend.RefFilterOptions opts) throws PermissionBackendException Filter a list of references by visibility.- Parameters:
refs
- a collection of references to filter.repo
- an openRepository
handle for this instance's projectopts
- further options for filtering.- Returns:
- a partition of the provided refs that are visible to the user that this instance is scoped to.
- Throws:
PermissionBackendException
- if failure consulting backend configuration.
-