Class BaseOperationCheck
- java.lang.Object
 - 
- com.atlassian.confluence.api.model.permissions.spi.BaseOperationCheck
 
 
- 
- All Implemented Interfaces:
 Operation,OperationCheck
@ExperimentalSpi public abstract class BaseOperationCheck extends Object implements OperationCheck
Base class for implementingOperationChecks. Plugins implementing their own checks should extend this.- Since:
 - 5.8
 
 
- 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedBaseOperationCheck(OperationKey operationKey, TargetType expectedTargetType)Construct aBaseOperationCheck. 
- 
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description @NonNull ValidationResultcanPerform(Person person, Target target)Delegates tocanPerform(Person, java.lang.Iterable).@NonNull Map<Target,ValidationResult>canPerform(Person person, Iterable<Target> targets)Validates targets are the correctTargetType, then delegates tocanPerformImpl(Person, java.lang.Iterable).@NonNull ValidationResultcanPerformAccordingToState(Person person, Target target)Delegates tocanPerformAccordingToState(Person, java.lang.Iterable).@NonNull Map<Target,ValidationResult>canPerformAccordingToState(Person person, Iterable<Target> targets)Validates targets are the correctTargetType, then delegates tocanPerformAccordingToStateImpl(Person, java.lang.Iterable).protected abstract @NonNull Map<Target,ValidationResult>canPerformAccordingToStateImpl(@NonNull Person person, @NonNull Iterable<Target> targets)Subclass implements this to perform canPerformAccordingToState checks on a collection of targets.protected abstract @NonNull Map<Target,ValidationResult>canPerformImpl(@NonNull Person person, @NonNull Iterable<Target> targets)Subclass implements this to perform canPerform checks on a collection of targets.@NonNull OperationKeygetOperationKey() 
 - 
 
- 
- 
Constructor Detail
- 
BaseOperationCheck
protected BaseOperationCheck(OperationKey operationKey, TargetType expectedTargetType)
Construct aBaseOperationCheck.- Parameters:
 operationKey- the operation forgetOperationKey().expectedTargetType- the singleTargetTypesupported by this check. This base class will check targets match this before callingcanPerformImpl(Person, java.lang.Iterable)orcanPerformAccordingToStateImpl(Person, java.lang.Iterable).
 
 - 
 
- 
Method Detail
- 
getOperationKey
public final @NonNull OperationKey getOperationKey()
- Specified by:
 getOperationKeyin interfaceOperation- Specified by:
 getOperationKeyin interfaceOperationCheck- Returns:
 - the 
OperationKeypassed to the constructor. 
 
- 
canPerform
public final @NonNull ValidationResult canPerform(Person person, Target target)
Delegates tocanPerform(Person, java.lang.Iterable).- Specified by:
 canPerformin interfaceOperationCheck- Parameters:
 person- the Person on which to perform a permission and validation checktarget- the Target to check permission for- Returns:
 - an authorized and valid result if Person has permission to perform operation on this target in its current state
 - an unauthorized result if permissions prevent Person performing the operation on this target
 - a not-valid result for the following cases:
 
- the operation is not currently valid for target due to its state
 - target doesn't exist
 
 
 
- 
canPerformAccordingToState
public final @NonNull ValidationResult canPerformAccordingToState(Person person, Target target)
Delegates tocanPerformAccordingToState(Person, java.lang.Iterable).- Specified by:
 canPerformAccordingToStatein interfaceOperationCheck- Parameters:
 person- the Person on which to perform a permission and validation checktarget- the Target to check permission for- Returns:
 - an authorized and valid result if Person can perform operation on this target in its current state
 - an authorized and invalid result if the state of the target prevents Person performing the operation on this target
 
 
- 
canPerform
public final @NonNull Map<Target,ValidationResult> canPerform(Person person, Iterable<Target> targets)
Validates targets are the correctTargetType, then delegates tocanPerformImpl(Person, java.lang.Iterable).- Specified by:
 canPerformin interfaceOperationCheck- Parameters:
 person- the Person on which to perform a permission and validation checktargets- the Targets to check permission for; must all be of the sameTargetType- Returns:
 - a Map providing a 
ValidationResultfor each of the supplied targets. Results for each target will be as follows:- an authorized and valid result if Person can perform operation on this target in its current state
 - an unauthorized result if permissions prevent Person performing the operation on this target
 - a not-valid result for the following cases:
 
- the operation is not currently valid for target due to its state
 - target doesn't exist
 
 
 
 
- 
canPerformAccordingToState
public final @NonNull Map<Target,ValidationResult> canPerformAccordingToState(Person person, Iterable<Target> targets)
Validates targets are the correctTargetType, then delegates tocanPerformAccordingToStateImpl(Person, java.lang.Iterable).- Specified by:
 canPerformAccordingToStatein interfaceOperationCheck- Parameters:
 person- the Person on which to perform a permission and validation checktargets- the Targets to check state for; must all be of the sameTargetType- Returns:
 - a Map providing a 
ValidationResultfor each of the supplied targets. Results for each target will be as follows:- an authorized and valid result if Person can perform operation on this target in its current state
 - an authorized and invalid result if the state of this target prevents Person performing the operation on this target
 
 
 
- 
canPerformImpl
protected abstract @NonNull Map<Target,ValidationResult> canPerformImpl(@NonNull Person person, @NonNull Iterable<Target> targets)
Subclass implements this to perform canPerform checks on a collection of targets.- Parameters:
 person- non-null Persontargets- non-null non-empty collection of Targets, each already validated as being non-null and having the correctTargetTypefor this operation check- Returns:
 - a map of validation results indicating whether each target in the list passes the check,
 as per contract of 
OperationCheck.canPerform(com.atlassian.confluence.api.model.people.Person, java.lang.Iterable) - Throws:
 UnsupportedTargetException- if target points to the wrong kind of object for this operation check (e.g. container target vs. specific object target)BadRequestException- See Also:
 SimpleValidationResult.builder()
 
- 
canPerformAccordingToStateImpl
protected abstract @NonNull Map<Target,ValidationResult> canPerformAccordingToStateImpl(@NonNull Person person, @NonNull Iterable<Target> targets)
Subclass implements this to perform canPerformAccordingToState checks on a collection of targets.- Parameters:
 person- non-null Persontargets- non-null non-empty collection of Targets, each already validated as being non-null and having the correctTargetTypefor this operation check- Returns:
 - a map of validation results indicating whether each target in the list passes the check,
 as per contract of 
OperationCheck.canPerformAccordingToState(com.atlassian.confluence.api.model.people.Person, java.lang.Iterable) - Throws:
 UnsupportedTargetException- if target points to the wrong kind of object for this operation check (e.g. container target vs. specific object target)BadRequestException- See Also:
 SimpleValidationResult.builder()
 
 - 
 
 -