@ExperimentalSpi public abstract class BaseOperationCheck extends Object implements OperationCheck
OperationChecks.
Plugins implementing their own checks should extend this.| Modifier | Constructor and Description |
|---|---|
protected |
BaseOperationCheck(OperationKey operationKey,
TargetType expectedTargetType)
Construct a
BaseOperationCheck. |
| Modifier and Type | Method and Description |
|---|---|
Map<Target,ValidationResult> |
canPerform(Person person,
Iterable<Target> targets)
Validates targets are the correct
TargetType,
then delegates to canPerformImpl(Person, java.lang.Iterable). |
ValidationResult |
canPerform(Person person,
Target target)
Delegates to
canPerform(Person, java.lang.Iterable). |
protected abstract Map<Target,ValidationResult> |
canPerformImpl(Person person,
Iterable<Target> targets)
Subclass implements this to perform canPerform checks on a collection of targets.
|
OperationKey |
getOperationKey() |
protected BaseOperationCheck(OperationKey operationKey, TargetType expectedTargetType)
BaseOperationCheck.operationKey - the operation for getOperationKey().expectedTargetType - the single TargetType supported by this check. This base class will check
targets match this before calling canPerformImpl(Person, java.lang.Iterable).@Nonnull public final OperationKey getOperationKey()
getOperationKey in interface OperationgetOperationKey in interface OperationCheckOperationKey passed to the constructor.@Nonnull public final ValidationResult canPerform(Person person, Target target)
canPerform(Person, java.lang.Iterable).canPerform in interface OperationCheckperson - the Person on which to perform a permission and validation checktarget - the Target to check permission for@Nonnull public final Map<Target,ValidationResult> canPerform(Person person, Iterable<Target> targets)
TargetType,
then delegates to canPerformImpl(Person, java.lang.Iterable).canPerform in interface OperationCheckperson - the Person on which to perform a permission and validation checktargets - the Targets to check permission for;
must all be of the same TargetTypeValidationResult for each of the supplied targets. Results for each target will
be as follows:
@Nonnull protected abstract Map<Target,ValidationResult> canPerformImpl(@Nonnull Person person, @Nonnull Iterable<Target> targets)
person - non-null Persontargets - non-null non-empty collection of Targets, each already validated as being non-null
and having the correct TargetType for this operation checkOperationCheck.canPerform(com.atlassian.confluence.api.model.people.Person, java.lang.Iterable)UnsupportedTargetException - if target points to the wrong kind of object for this operation check
(e.g. container target vs. specific object target)BadRequestExceptionSimpleValidationResult.builder()Copyright © 2003–2015 Atlassian. All rights reserved.