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.BatchAccessCheckercanCreateEntity(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.IdentifiedContentKey identifiedKey)Checks whether the given role/principal is allowed to create a new entity value as defined by theIdentifiedContentKeyfor the givenBranch, called for aOperation.Putoperation in a commit.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.IdentifiedContentKey identifiedKey)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.IdentifiedContentKey identifiedKey)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.IdentifiedContentKey identifiedKey)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.BatchAccessCheckercanReadRepositoryConfig(org.projectnessie.model.RepositoryConfig.Type repositoryConfigType)BatchAccessCheckercanUpdateEntity(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.IdentifiedContentKey identifiedKey)Checks whether the given role/principal is allowed to update an existing entity value as defined by theIdentifiedContentKeyfor the givenBranch, called for aOperation.Putoperation in a commit.BatchAccessCheckercanUpdateRepositoryConfig(org.projectnessie.model.RepositoryConfig.Type repositoryConfigType)BatchAccessCheckercanViewReference(org.projectnessie.versioned.NamedRef ref)Checks whether the given role/principal is allowed to view/list the givenBranch/TagorDetached.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:
- map 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
@CanIgnoreReturnValue BatchAccessChecker can(Check check)
-
canViewReference
@CanIgnoreReturnValue 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
@CanIgnoreReturnValue BatchAccessChecker canCreateReference(org.projectnessie.versioned.NamedRef ref)
Checks whether the given role/principal is allowed to create aBranch/Tag.- Parameters:
ref- TheNamedRefto check
-
canAssignRefToHash
@CanIgnoreReturnValue 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
@CanIgnoreReturnValue BatchAccessChecker canDeleteReference(org.projectnessie.versioned.NamedRef ref)
Checks whether the given role/principal is allowed to delete aBranch/Tag.- Parameters:
ref- TheNamedRefto check
-
canReadEntries
@CanIgnoreReturnValue 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
@CanIgnoreReturnValue BatchAccessChecker canReadContentKey(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.IdentifiedContentKey identifiedKey)
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 referenceidentifiedKey- content key / ID / type to check
-
canListCommitLog
@CanIgnoreReturnValue 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
@CanIgnoreReturnValue 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
@CanIgnoreReturnValue BatchAccessChecker canReadEntityValue(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.IdentifiedContentKey identifiedKey)
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 checkidentifiedKey- content key / ID / type to check
-
canCreateEntity
@CanIgnoreReturnValue BatchAccessChecker canCreateEntity(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.IdentifiedContentKey identifiedKey)
Checks whether the given role/principal is allowed to create a new entity value as defined by theIdentifiedContentKeyfor the givenBranch, called for aOperation.Putoperation in a commit.Adds an implicit
canViewReference(NamedRef).- Parameters:
ref- TheNamedRefto checkidentifiedKey- content key / ID / type to check
-
canUpdateEntity
@CanIgnoreReturnValue BatchAccessChecker canUpdateEntity(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.IdentifiedContentKey identifiedKey)
Checks whether the given role/principal is allowed to update an existing entity value as defined by theIdentifiedContentKeyfor the givenBranch, called for aOperation.Putoperation in a commit.Adds an implicit
canViewReference(NamedRef).- Parameters:
ref- TheNamedRefto checkidentifiedKey- content key / ID / type to check
-
canDeleteEntity
@CanIgnoreReturnValue BatchAccessChecker canDeleteEntity(org.projectnessie.versioned.NamedRef ref, org.projectnessie.model.IdentifiedContentKey identifiedKey)
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 checkidentifiedKey- content key / ID / type to check
-
canReadRepositoryConfig
@CanIgnoreReturnValue BatchAccessChecker canReadRepositoryConfig(org.projectnessie.model.RepositoryConfig.Type repositoryConfigType)
-
canUpdateRepositoryConfig
@CanIgnoreReturnValue BatchAccessChecker canUpdateRepositoryConfig(org.projectnessie.model.RepositoryConfig.Type repositoryConfigType)
-
-