Interface BatchAccessChecker
-
- All Known Implementing Classes:
AbstractBatchAccessChecker
public interface BatchAccessCheckerAccept various allowance-checks and retrieve the result of all operations at once.The purpose of the
BatchAccessCheckeris to accept all required checks via thecan...()methods and return the result of these "can do xyz" checks viacheck().The checks make sure that a particular role is allowed to perform an action (such as creation, deletion) on a
NamedRef(Branch/Tag). Additionally, this interface also provides checks based on a givenContentKey.It is safe to call a check method with the same arguments multiple times.
Implementations can expect that either
check()orcheckAndThrow()are called either once or never.- See Also:
Check,Check.CheckType,AbstractBatchAccessChecker
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description BatchAccessCheckercan(Check check)BatchAccessCheckercanAssignRefToHash(org.projectnessie.versioned.NamedRef ref)Checks whether the given role/principal is allowed to assign the givenBranch/Tagto a commit id.BatchAccessCheckercanCommitChangeAgainstReference(org.projectnessie.versioned.NamedRef ref)Checks whether the given role/principal is allowed to commit changes against the givenBranch/TagorDetached.BatchAccessCheckercanCreateReference(org.projectnessie.versioned.NamedRef ref)Checks whether the given role/principal is allowed to create aBranch/Tag.BatchAccessCheckercanDeleteEntity(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.ContentKey key, java.lang.String contentId)Checks whether the given role/principal is allowed to delete an entity value as defined by theContentKeyfor the givenBranch, called for aOperation.Deleteoperation in a commit.BatchAccessCheckercanDeleteReference(org.projectnessie.versioned.NamedRef ref)Checks whether the given role/principal is allowed to delete aBranch/Tag.BatchAccessCheckercanListCommitLog(org.projectnessie.versioned.NamedRef ref)Checks whether the given role/principal is allowed to list the commit log for the givenBranch/TagorDetached.BatchAccessCheckercanReadContentKey(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.ContentKey key, java.lang.String contentId)Called for every content-key about to be returned from, for example, a "get commit log" operation.BatchAccessCheckercanReadEntityValue(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.ContentKey key, java.lang.String contentId)Checks whether the given role/principal is allowed to read an entity value as defined by theContentKeyfor the givenBranch/TagorDetached.BatchAccessCheckercanReadEntries(org.projectnessie.versioned.NamedRef ref)Checks whether the given role/principal is allowed to read entries content for the givenBranch/TagorDetached.BatchAccessCheckercanUpdateEntity(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.ContentKey key, java.lang.String contentId, org.projectnessie.model.Content.Type contentType)Checks whether the given role/principal is allowed to update an entity value as defined by theContentKeyfor the givenBranch, called for aOperation.Putoperation in a commit.BatchAccessCheckercanViewReference(org.projectnessie.versioned.NamedRef ref)Checks whether the given role/principal is allowed to view/list the givenBranch/TagorDetached.BatchAccessCheckercanViewRefLog()Checks whether the given role/principal is allowed to view the reflog entries.java.util.Map<Check,java.lang.String>check()Checks the recorded checks.default voidcheckAndThrow()Convenience methods that throws anAccessCheckException, ifcheck()returns a non-empty map.static voidthrowForFailedChecks(java.util.Map<Check,java.lang.String> failedChecks)
-
-
-
Method Detail
-
check
java.util.Map<Check,java.lang.String> check()
Checks the recorded checks.- Returns:
- set of failed checks or an empty collection, if all checks passed
-
checkAndThrow
default void checkAndThrow() throws AccessCheckExceptionConvenience methods that throws anAccessCheckException, ifcheck()returns a non-empty map.- Throws:
AccessCheckException
-
throwForFailedChecks
static void throwForFailedChecks(java.util.Map<Check,java.lang.String> failedChecks) throws AccessCheckException
- Throws:
AccessCheckException
-
can
BatchAccessChecker can(Check check)
-
canViewReference
BatchAccessChecker canViewReference(org.projectnessie.versioned.NamedRef ref)
Checks whether the given role/principal is allowed to view/list the givenBranch/TagorDetached.- Parameters:
ref- TheNamedRefto check
-
canCreateReference
BatchAccessChecker canCreateReference(org.projectnessie.versioned.NamedRef ref)
Checks whether the given role/principal is allowed to create aBranch/Tag.- Parameters:
ref- TheNamedRefto check
-
canAssignRefToHash
BatchAccessChecker canAssignRefToHash(org.projectnessie.versioned.NamedRef ref)
Checks whether the given role/principal is allowed to assign the givenBranch/Tagto a commit id.Adds an implicit
canViewReference(NamedRef).- Parameters:
ref- TheNamedRefto check not granted.
-
canDeleteReference
BatchAccessChecker canDeleteReference(org.projectnessie.versioned.NamedRef ref)
Checks whether the given role/principal is allowed to delete aBranch/Tag.- Parameters:
ref- TheNamedRefto check
-
canReadEntries
BatchAccessChecker canReadEntries(org.projectnessie.versioned.NamedRef ref)
Checks whether the given role/principal is allowed to read entries content for the givenBranch/TagorDetached.Adds an implicit
canViewReference(NamedRef).- Parameters:
ref- TheNamedRefto check
-
canReadContentKey
BatchAccessChecker canReadContentKey(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.ContentKey key, @Nullable @Nullable java.lang.String contentId)
Called for every content-key about to be returned from, for example, a "get commit log" operation.This is an additional check for each content-key. "Early" checks, that run before generating the result, like
canReadEntries(NamedRef)orcanListCommitLog(NamedRef), run as well.Adds an implicit
canViewReference(NamedRef).- Parameters:
ref- current referencekey- content key to checkcontentId- content id to check, may benull, for example, forOperation.DeletefromOperations in the commit log.
-
canListCommitLog
BatchAccessChecker canListCommitLog(org.projectnessie.versioned.NamedRef ref)
Checks whether the given role/principal is allowed to list the commit log for the givenBranch/TagorDetached.Adds an implicit
canViewReference(NamedRef).- Parameters:
ref- TheNamedRefto check
-
canCommitChangeAgainstReference
BatchAccessChecker canCommitChangeAgainstReference(org.projectnessie.versioned.NamedRef ref)
Checks whether the given role/principal is allowed to commit changes against the givenBranch/TagorDetached.Adds an implicit
canViewReference(NamedRef).- Parameters:
ref- TheNamedRefto check
-
canReadEntityValue
BatchAccessChecker canReadEntityValue(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.ContentKey key, java.lang.String contentId)
Checks whether the given role/principal is allowed to read an entity value as defined by theContentKeyfor the givenBranch/TagorDetached.Adds an implicit
canViewReference(NamedRef).- Parameters:
ref- TheNamedRefto checkkey- TheContentKeyto checkcontentId- The ID of theContentobject. See the ContentId docs for how to use this.
-
canUpdateEntity
BatchAccessChecker canUpdateEntity(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.ContentKey key, java.lang.String contentId, org.projectnessie.model.Content.Type contentType)
Checks whether the given role/principal is allowed to update an entity value as defined by theContentKeyfor the givenBranch, called for aOperation.Putoperation in a commit.Adds an implicit
canViewReference(NamedRef).- Parameters:
ref- TheNamedRefto checkkey- TheContentKeyto checkcontentId- The ID of theContentobject. See the ContentId docs for how to use this.contentType- theContent.Typeof the entity value.
-
canDeleteEntity
BatchAccessChecker canDeleteEntity(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.ContentKey key, java.lang.String contentId)
Checks whether the given role/principal is allowed to delete an entity value as defined by theContentKeyfor the givenBranch, called for aOperation.Deleteoperation in a commit.Adds an implicit
canViewReference(NamedRef).- Parameters:
ref- TheNamedRefto checkkey- TheContentKeyto checkcontentId- The ID of theContentobject. See the ContentId docs for how to use this.
-
canViewRefLog
BatchAccessChecker canViewRefLog()
Checks whether the given role/principal is allowed to view the reflog entries.
-
-