@ParametersAreNonnullByDefault public class OperationServiceImpl extends Object implements OperationService
Constructor and Description |
---|
OperationServiceImpl(Map<TargetType,OperationDelegate> operationDelegates,
PersonFactory personFactory,
UserAccessorInternal userAccessor,
PermissionCheckExemptions permissionCheckExemptions) |
Modifier and Type | Method and Description |
---|---|
Map<Target,ValidationResult> |
canPerform(Person person,
Operation operation,
Iterable<Target> targets)
Check whether the specified Person can perform a particular operation on each of the specified targets.
|
ValidationResult |
canPerform(Person person,
Operation operation,
Target target)
Check whether a person can perform a particular operation on a particular target.
|
Map<Target,ValidationResult> |
canPerformWithoutExemptions(Person person,
Operation operation,
Iterable<Target> targets)
Check whether the specified Person can perform a particular operation on each of the specified targets.
|
ValidationResult |
canPerformWithoutExemptions(Person person,
Operation operation,
Target target)
Check whether a person can perform a particular operation on a particular target.
|
List<OperationDescription> |
getAllOperationsForType(TargetType targetType)
For a given target type, list all operations this service can provide information about.
|
List<OperationCheckResult> |
getAvailableOperations(Person person,
Target target)
List all operations that a person can perform on a particular target.
|
List<OperationCheckResult> |
getAvailableOperations(Target target)
List all operations that the current user can perform on a particular target.
|
<T> T |
withExemption(Supplier<T> task)
Execute the given task with permission exemption.
|
public OperationServiceImpl(Map<TargetType,OperationDelegate> operationDelegates, PersonFactory personFactory, UserAccessorInternal userAccessor, PermissionCheckExemptions permissionCheckExemptions)
@Nonnull public List<OperationDescription> getAllOperationsForType(TargetType targetType)
OperationService
getAllOperationsForType
in interface OperationService
@Nonnull public List<OperationCheckResult> getAvailableOperations(Person person, Target target)
OperationService
getAvailableOperations
in interface OperationService
person
- the Person on which to perform a permission and validation checktarget
- the Target to check permission forOperationService.canPerform(Person, Operation, Target)
would return a valid and authorized
result.@Nonnull public List<OperationCheckResult> getAvailableOperations(Target target)
OperationService
getAvailableOperations
in interface OperationService
target
- the Target to check permission forOperationService.canPerform(Person, Operation, Target)
would return a valid and authorized
result.@Nonnull public final ValidationResult canPerform(Person person, Operation operation, Target target)
OperationService
canPerform
in interface OperationService
person
- the Person on which to perform a permission and validation checkoperation
- the operation to check permission fortarget
- the Target to check permission for@Nonnull public ValidationResult canPerformWithoutExemptions(Person person, Operation operation, Target target)
OperationService
This check doesn't grant permission exemptions when called using #withExemption(Runnable)
.
canPerformWithoutExemptions
in interface OperationService
person
- the Person on which to perform a permission and validation checkoperation
- the operation to check permission fortarget
- the Target to check permission for@Nonnull public final Map<Target,ValidationResult> canPerform(Person person, Operation operation, Iterable<Target> targets)
OperationService
OperationService.canPerform(Person, Operation, Target)
.)canPerform
in interface OperationService
person
- the Person on which to perform a permission and validation checkoperation
- the operation to check permission fortargets
- the Targets to individually check permission for; at least one target is required;
must all be of the same TargetType
ValidationResult
for each of the supplied targets. Results for each target will
be as follows:
@Nonnull public Map<Target,ValidationResult> canPerformWithoutExemptions(Person person, Operation operation, Iterable<Target> targets)
OperationService
OperationService.canPerform(Person, Operation, Target)
.)
This check doesn't grant permission exemptions when called using #withExemption(Runnable)
.
canPerformWithoutExemptions
in interface OperationService
person
- the Person on which to perform a permission and validation checkoperation
- the operation to check permission fortargets
- the Targets to individually check permission for; at least one target is required;
must all be of the same TargetType
ValidationResult
for each of the supplied targets. Results for each target will
be as follows:
public <T> T withExemption(Supplier<T> task)
OperationService
Calls to OperationService.canPerform(Person, Operation, Iterable)
and OperationService.canPerform(Person, Operation, Target)
within the executed task will return an authorized and valid result if the operation can be performed on each
target based on the target's state, irrespective of the user's permissions. Calls to other permission checks in
confluence may also be affected.
Use with care.
withExemption
in interface OperationService
task
- task to execute with permission exemptionCopyright © 2003–2017 Atlassian. All rights reserved.