Class PermissionBackend.ForProject
- java.lang.Object
-
- com.google.gerrit.server.permissions.PermissionBackend.ForProject
-
- Enclosing class:
- PermissionBackend
public abstract static class PermissionBackend.ForProject extends Object
PermissionBackend scoped to a user and project.
-
-
Constructor Summary
Constructors Constructor Description ForProject()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description PermissionBackend.ForChangechange(ChangeNotes notes)Returns an instance scoped for the change, and its destination ref and project.PermissionBackend.ForChangechange(ChangeData cd)Returns an instance scoped for the change, and its destination ref and project.abstract voidcheck(CoreOrPluginProjectPermission perm)Verify scoped user canperm, throwing if denied.Map<String,org.eclipse.jgit.lib.Ref>filter(List<org.eclipse.jgit.lib.Ref> refs, org.eclipse.jgit.lib.Repository repo, PermissionBackend.RefFilterOptions opts)Filter a list of references by visibility.abstract Map<String,org.eclipse.jgit.lib.Ref>filter(Map<String,org.eclipse.jgit.lib.Ref> refs, org.eclipse.jgit.lib.Repository repo, PermissionBackend.RefFilterOptions opts)Filter a map of references by visibility.PermissionBackend.ForChangeindexedChange(ChangeData cd, ChangeNotes notes)Returns an instance scoped for the change loaded from index, and its destination ref and project.abstract PermissionBackend.ForRefref(String ref)Returns an instance scoped forrefin this project.abstract StringresourcePath()Returns the fully qualified resource path that this instance is scoped to.booleantest(CoreOrPluginProjectPermission perm)abstract <T extends CoreOrPluginProjectPermission>
Set<T>test(Collection<T> permSet)FilterpermSetto permissions scoped user might be able to perform.abstract BooleanConditiontestCond(CoreOrPluginProjectPermission perm)booleantestOrFalse(CoreOrPluginProjectPermission perm)
-
-
-
Method Detail
-
resourcePath
public abstract String resourcePath()
Returns the fully qualified resource path that this instance is scoped to.
-
ref
public abstract PermissionBackend.ForRef ref(String ref)
Returns an instance scoped forrefin this project.
-
change
public PermissionBackend.ForChange change(ChangeData cd)
Returns an instance scoped for the change, and its destination ref and project.
-
change
public PermissionBackend.ForChange change(ChangeNotes notes)
Returns an instance scoped for the change, and its destination ref and project.
-
indexedChange
public PermissionBackend.ForChange indexedChange(ChangeData cd, ChangeNotes notes)
Returns an instance scoped for the change loaded from index, and its destination ref and project. This method should only be used when database access is harmful and potentially stale data from the index is acceptable.
-
check
public abstract void check(CoreOrPluginProjectPermission perm) throws AuthException, PermissionBackendException
Verify scoped user canperm, throwing if denied.
-
test
public abstract <T extends CoreOrPluginProjectPermission> Set<T> test(Collection<T> permSet) throws PermissionBackendException
FilterpermSetto permissions scoped user might be able to perform.- Throws:
PermissionBackendException
-
test
public boolean test(CoreOrPluginProjectPermission perm) throws PermissionBackendException
- Throws:
PermissionBackendException
-
testOrFalse
public boolean testOrFalse(CoreOrPluginProjectPermission perm)
-
testCond
public abstract BooleanCondition testCond(CoreOrPluginProjectPermission perm)
-
filter
public abstract Map<String,org.eclipse.jgit.lib.Ref> filter(Map<String,org.eclipse.jgit.lib.Ref> refs, org.eclipse.jgit.lib.Repository repo, PermissionBackend.RefFilterOptions opts) throws PermissionBackendException
Filter a map of references by visibility.- Parameters:
refs- a map of references to filter.repo- an openRepositoryhandle 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.
-
filter
public Map<String,org.eclipse.jgit.lib.Ref> filter(List<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 list of references to filter.repo- an openRepositoryhandle 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.
-
-