public class DefaultContentRestrictionServiceValidator extends Object implements ContentRestrictionService.Validator
ContentRestrictionService.Validator
Contains per-service-operation methods as we used to in other services/validators.
Also contains some package-private methods for performing more granular checks.
Validation by validator should be the first thing to do on all the public service methods of ContentRestrictionService
implementations.Constructor and Description |
---|
DefaultContentRestrictionServiceValidator(ContentEntityManagerInternal contentEntityManager,
PermissionManager permissionManager,
UserAccessorInternal userAccessorInternal,
com.atlassian.user.GroupManager groupManager) |
Modifier and Type | Method and Description |
---|---|
ValidationResult |
validateAddDirectRestrictionForSubject(ContentId contentId,
OperationKey operationKey,
Subject subject)
Validates that:
OperationKey supplied is supported
Subject supplied is either User or a Group and does exist
Content specified exists AND can be viewed by the currently logged-in user
Currently logged-in user is allowed to alter ContentRestrictions on and edit the content specified
|
ValidationResult |
validateAddRestrictions(ContentId contentId,
Collection<? extends ContentRestriction> contentRestrictions)
Validates that:
Content specified exists AND can be viewed by the currently logged-in user
Currently logged-in user is allowed to alter ContentRestrictions on and edit the content specified
Input data is enough to proceed with the operation
Input data should not conflict with any restrictions existing
|
ValidationResult |
validateDeleteAllDirectRestrictions(ContentId contentId)
Validates that:
Content specified exists AND can be viewed by the currently logged-in user
Currently logged-in user is allowed to alter ContentRestrictions on and edit the content specified
|
ValidationResult |
validateDeleteDirectRestrictionForSubject(ContentId contentId,
OperationKey operationKey,
Subject subject)
Validates that:
OperationKey supplied is supported
Subject supplied is either User or a Group
Content specified exists AND can be viewed by the currently logged-in user
Currently logged-in user is allowed to alter ContentRestrictions on and edit the content specified
|
ValidationResult |
validateGetRestrictions(ContentId contentId)
Validates whether content specified exists and whether currently logged in user can read restrictions on a content specified.
|
ValidationResult |
validateGetRestrictionsForOperation(ContentId contentId,
OperationKey opKey)
Validates whether OperationKey supplied is supported, whether content specified exists, whether currently logged in user can read restrictions on a content specified
|
ValidationResult |
validateHasDirectRestrictionsForSubject(ContentId contentId,
OperationKey operationKey,
Subject subject)
Validates that:
OperationKey supplied is supported
Subject supplied is either User or a Group
Content specified exists AND can be viewed by the currently logged-in user
|
ValidationResult |
validateUpdateRestrictions(ContentId contentId,
Collection<? extends ContentRestriction> contentRestrictions)
Validates that:
Content specified exists AND can be viewed by the currently logged-in user
Input data is enough to proceed with the operation
Currently logged-in user is allowed to alter ContentRestrictions on and edit the content specified
Returns first of the failed validation results or a
ValidationResult which is both authorised and valid. |
public DefaultContentRestrictionServiceValidator(ContentEntityManagerInternal contentEntityManager, PermissionManager permissionManager, UserAccessorInternal userAccessorInternal, com.atlassian.user.GroupManager groupManager)
public ValidationResult validateUpdateRestrictions(ContentId contentId, Collection<? extends ContentRestriction> contentRestrictions)
ContentRestrictionService.Validator
ValidationResult
which is both authorised and valid.validateUpdateRestrictions
in interface ContentRestrictionService.Validator
contentId
- identifier of a content for which the check should be performedcontentRestrictions
- Collection
of something which can be cast to ContentRestriction
s.ValidationResult
where ValidationResult.isValid() == false
or ValidationResult.isAuthorized() == false
in case something is wrong with the data passed. Returns completely okay ValidationResult otherwise.public ValidationResult validateAddRestrictions(ContentId contentId, Collection<? extends ContentRestriction> contentRestrictions)
ContentRestrictionService.Validator
validateAddRestrictions
in interface ContentRestrictionService.Validator
contentId
- identifier of a content for which the check should be performedcontentRestrictions
- Collection
of something which can be cast to ContentRestriction
s.ValidationResult
where ValidationResult.isValid() == false
or ValidationResult.isAuthorized() == false
in case something is wrong with the data passed. Returns completely okay ValidationResult otherwise.public ValidationResult validateDeleteAllDirectRestrictions(ContentId contentId)
ContentRestrictionService.Validator
validateDeleteAllDirectRestrictions
in interface ContentRestrictionService.Validator
contentId
- identifier of a content for which the check should be performedValidationResult
where ValidationResult.isValid() == false
or ValidationResult.isAuthorized() == false
in case something is wrong with the data passed. Returns completely okay ValidationResult otherwise.public ValidationResult validateHasDirectRestrictionsForSubject(ContentId contentId, OperationKey operationKey, Subject subject)
ContentRestrictionService.Validator
validateHasDirectRestrictionsForSubject
in interface ContentRestrictionService.Validator
contentId
- identifier of a content for which the check should be performedValidationResult
where ValidationResult.isValid() == false
or ValidationResult.isAuthorized() == false
in case something is wrong with the data passed. Returns completely okay ValidationResult otherwise.public ValidationResult validateDeleteDirectRestrictionForSubject(ContentId contentId, OperationKey operationKey, Subject subject)
ContentRestrictionService.Validator
validateDeleteDirectRestrictionForSubject
in interface ContentRestrictionService.Validator
public ValidationResult validateAddDirectRestrictionForSubject(ContentId contentId, OperationKey operationKey, Subject subject)
ContentRestrictionService.Validator
validateAddDirectRestrictionForSubject
in interface ContentRestrictionService.Validator
public ValidationResult validateGetRestrictions(ContentId contentId)
ContentRestrictionService.Validator
validateGetRestrictions
in interface ContentRestrictionService.Validator
contentId
- identifier of a content for which the check should be performedValidationResult
where ValidationResult.isValid() == false
in case content is missing or unavailable.public ValidationResult validateGetRestrictionsForOperation(ContentId contentId, OperationKey opKey)
ContentRestrictionService.Validator
validateGetRestrictionsForOperation
in interface ContentRestrictionService.Validator
contentId
- identifier of a content for which the check should be performedopKey
- OperationKey
which user tries to obtain restrictions forValidationResult
where ValidationResult.isValid() == false
in case content is missing or unavailable or OperationKey
supplied is not supported.ContentRestrictionService.Validator.validateGetRestrictions(ContentId)
Copyright © 2003–2021 Atlassian. All rights reserved.