Class RemoteContentRestrictionServiceImpl
java.lang.Object
com.atlassian.confluence.rest.client.AbstractRemoteService<ContentRestrictionService>
com.atlassian.confluence.rest.client.RemoteContentRestrictionServiceImpl
- All Implemented Interfaces:
- RemoteContentRestrictionService
public class RemoteContentRestrictionServiceImpl
extends AbstractRemoteService<ContentRestrictionService>
implements RemoteContentRestrictionService
- 
Field SummaryFields inherited from class com.atlassian.confluence.rest.client.AbstractRemoteServiceprovider
- 
Constructor SummaryConstructorsConstructorDescriptionRemoteContentRestrictionServiceImpl(AuthenticatedWebResourceProvider provider, ExecutorService executor) 
- 
Method SummaryModifier and TypeMethodDescriptionaddDirectRestrictionForSubjectCompletionStage(ContentId contentId, OperationKey operationKey, Subject subject) Adds singular directContentRestrictionforoperationKeyandsubjectto the content identified bycontentIdparameter.addRestrictionsCompletionStage(ContentId target, Collection<? extends ContentRestriction> contentRestrictions, Expansion... expansions) Attempts to add all the restrictions specified to a piece of content identified bycontentId.deleteAllDirectRestrictionsCompletionStage(ContentId target, Expansion... expansions) Attempts to delete all the restrictions specified directly on a piece of content identified bycontentId.deleteDirectRestrictionForSubjectCompletionStage(ContentId contentId, OperationKey operationKey, Subject subject) Deletes singular directContentRestrictionforoperationKeyandsubjectfrom the content identified bycontentIdparameter.getRelevantViewRestrictionsForContentCompletionStage(ContentId target, Expansion... expansions) Return a list of view content permission set which need to be passed in other to access this content.getRestrictionsCompletionStage(ContentId target, PageRequest pageRequest, Expansion... expansions) Retrieves all the restrictions for all the operations on a given Content.getRestrictionsForOperationCompletionStage(ContentId target, OperationKey operationKey, PageRequest pageRequest, Expansion... expansions) Retrieves all restrictions for given operation key on given content.getRestrictionsGroupByOperationCompletionStage(ContentId target, Expansion... expansions) List all restrictions that exist directly on the given content.hasDirectRestrictionForSubjectCompletionStage(ContentId contentId, OperationKey operationKey, Subject subject) Returnstrueif the User or Group specified by thesubjectparameter has restriction(s) for theoperationKeyoperation which are specified directly on the Content identified bycontentIdparameter.updateRestrictionsCompletionStage(ContentId target, Collection<? extends ContentRestriction> contentRestrictions, Expansion... expansions) Sets all the restrictions specified to a piece of content identified bycontentId, replacing any existing permissions.Methods inherited from class com.atlassian.confluence.rest.client.AbstractRemoteServiceaddExpansions, addPageRequest, addPageRequestParams, deleteCompletionStage, deleteCompletionStage, getCompletionStage, getCompletionStageGenericCollection, getCompletionStageMap, getCompletionStageMapOfGenericListResponse, getCompletionStageMapOfPageResponses, getCompletionStageOptional, getCompletionStagePageResponseList, getCompletionStageSearchPageResponseList, getExecutor, newExperimentalRestWebTarget, newWebTarget, postCompletionStage, postCompletionStage, postCompletionStage, postCompletionStageToPageResponse, postVoidCompletionStage, putCompletionStage, putVoidCompletionStage
- 
Constructor Details- 
RemoteContentRestrictionServiceImplpublic RemoteContentRestrictionServiceImpl(AuthenticatedWebResourceProvider provider, ExecutorService executor) - Since:
- 9.0
 
 
- 
- 
Method Details- 
getRelevantViewRestrictionsForContentCompletionStagepublic CompletionStage<RelevantViewRestrictions> getRelevantViewRestrictionsForContentCompletionStage(ContentId target, Expansion... expansions) Description copied from interface:RemoteContentRestrictionServiceReturn a list of view content permission set which need to be passed in other to access this content. This will include read restriction from current content and all read restriction from ancestor- Specified by:
- getRelevantViewRestrictionsForContentCompletionStagein interface- RemoteContentRestrictionService
- Parameters:
- target- the id of the content to look up permissions for
- expansions- the expansions to apply to the returned data. These expansions start from the operation itself.
- Returns:
- map between inherited restriction type and it read restrictions
 
- 
getRestrictionsGroupByOperationCompletionStagepublic CompletionStage<Map<OperationKey,ContentRestriction>> getRestrictionsGroupByOperationCompletionStage(ContentId target, Expansion... expansions) throws ServiceException Description copied from interface:RemoteContentRestrictionServiceList all restrictions that exist directly on the given content. Note that the subjects returned in each ContentRestriction are hard-limited to an arbitrary maximum size. Obtaining more can be done via themethod.invalid reference#getRestrictionsForOperation- Specified by:
- getRestrictionsGroupByOperationCompletionStagein interface- RemoteContentRestrictionService
- Parameters:
- target- the id of the content to look up permissions for
- expansions- the expansions to apply to the returned data. These expansions start from the operation itself.
- Returns:
- a Map of all ContentRestrictions, grouped by operation key
- Throws:
- ServiceException
 
- 
getRestrictionsForOperationCompletionStagepublic CompletionStage<ContentRestriction> getRestrictionsForOperationCompletionStage(ContentId target, OperationKey operationKey, PageRequest pageRequest, Expansion... expansions) throws ServiceException Description copied from interface:RemoteContentRestrictionServiceRetrieves all restrictions for given operation key on given content.- Specified by:
- getRestrictionsForOperationCompletionStagein interface- RemoteContentRestrictionService
- Parameters:
- target- the id of the content to look up permissions for
- operationKey- the operation key to look up restrictions for
- pageRequest- pagination through the subjects contained within the ContentRestriction
- expansions- the expansions to the ContentRestriction.
- Returns:
- ContentRestriction containing relevant restrictions for given operation key, or null if operation key does not have corresponding restrictions.
- Throws:
- ServiceException
 
- 
getRestrictionsCompletionStagepublic CompletionStage<ContentRestrictionsPageResponse> getRestrictionsCompletionStage(ContentId target, PageRequest pageRequest, Expansion... expansions) throws NotFoundException Description copied from interface:RemoteContentRestrictionServiceRetrieves all the restrictions for all the operations on a given Content.- Specified by:
- getRestrictionsCompletionStagein interface- RemoteContentRestrictionService
- Parameters:
- target- the id of the content to look up permissions for
- pageRequest- pagination through the list of all the ContentRestrictions returned
- expansions- the expansions to the ContentRestriction
- Returns:
- a paginated response, containing all the ContentRestrictions for the given content
- Throws:
- NotFoundException- if given content id does not exist, or is not viewable by user
 
- 
updateRestrictionsCompletionStagepublic CompletionStage<ContentRestrictionsPageResponse> updateRestrictionsCompletionStage(ContentId target, Collection<? extends ContentRestriction> contentRestrictions, Expansion... expansions) throws ServiceException Description copied from interface:RemoteContentRestrictionServiceSets all the restrictions specified to a piece of content identified bycontentId, replacing any existing permissions. Setting per-content restrictions is currently allowed for Pages or BlogPosts only.Rules of applying restrictions via this method: - Provided collection of ContentRestrictions is allowed to have only 1 (ONE)ContentRestrictionobject for each operation.
- Provided ContentRestrictions will replace (overwrite) any pre-existing restrictions on the Content under the corresponding operations.
- In case provided collection of ContentRestriction does not have any of the operations supported it is assumed that restrictions for such operation should not be changed at all.
- Restrictions with the "users" and/or "groups" map entries explicitly set to be empty arrays will result in removing corresponding restrictions for the content.
- Restrictions with the "users" and/or "groups" map entries missing will result in not changing corresponding operation's user/group restrictions for the content.
- It is not allowed to edit the restrictions in such a way which would remove requesting user's access.
- Only Page, BlogPost and other add-on provided Content Types that support direct content restrictions are supported.
 - Specified by:
- updateRestrictionsCompletionStagein interface- RemoteContentRestrictionService
- Parameters:
- target- the id of the content to assign restrictions to
- contentRestrictions- Collection of- ContentRestrictions to apply to the Content specified
- expansions- the expansions to the ContentRestriction. To be expanded on response.
- Returns:
- ContentRestrictionsPageResponsedescribing the new state of the content identified by- contentId(same aswould return)- invalid reference- #getRestrictions(ContentId, PageRequest, Expansion...)
- Throws:
- ServiceException- or one of it subtypes.
 
- Provided collection of 
- 
addRestrictionsCompletionStagepublic CompletionStage<ContentRestrictionsPageResponse> addRestrictionsCompletionStage(ContentId target, Collection<? extends ContentRestriction> contentRestrictions, Expansion... expansions) throws ServiceException Description copied from interface:RemoteContentRestrictionServiceAttempts to add all the restrictions specified to a piece of content identified bycontentId. Does not replace/remove/alter any pre-existingContentRestrictions. ProvidedContentRestrictions will be added, i.e. "merged with" any pre-existing restrictions on the Content under the corresponding operations. Changing per-content restrictions is currently allowed for Pages or BlogPosts only.Rules of applying restrictions via this method: - Provided collection of ContentRestrictions is allowed to have only 1 (ONE)ContentRestrictionobject for each operation.
- Provided ContentRestrictions will be added, i.e. "merged with" any pre-existing restrictions on the Content under the corresponding operations.
- In case provided collection of ContentRestriction does not have any of the operations supported no changes will happen.
- Restrictions with the "users" and/or "groups" map entries explicitly set to be empty arrays will result in not changing corresponding operation's user/group restrictions for the content.
- Restrictions with the "users" and/or "groups" map entries missing will result in not changing corresponding operation's user/group restrictions for the content.
- It is not allowed to edit the restrictions in such a way which would remove requesting user's access.
- Only Page, BlogPost and other add-on provided Content Types that support direct content restrictions are supported.
 - Specified by:
- addRestrictionsCompletionStagein interface- RemoteContentRestrictionService
- Parameters:
- target- the id of the content to add restrictions to
- contentRestrictions- Collection of- ContentRestrictions to apply to the Content specified
- expansions- the expansions to the ContentRestriction. To be expanded on response.
- Returns:
- ContentRestrictionsPageResponsedescribing the new state of the content identified by- contentId(same aswould return)- invalid reference- #getRestrictions(ContentId, PageRequest, Expansion...)
- Throws:
- ServiceException- or one of it subtypes.
 
- Provided collection of 
- 
deleteAllDirectRestrictionsCompletionStagepublic CompletionStage<ContentRestrictionsPageResponse> deleteAllDirectRestrictionsCompletionStage(ContentId target, Expansion... expansions) throws ServiceException Description copied from interface:RemoteContentRestrictionServiceAttempts to delete all the restrictions specified directly on a piece of content identified bycontentId. "specified directly" means that deleting restrictions on some content won't affect any restrictions inherited from its parents. Changing per-content restrictions is currently allowed for Pages, Blog Posts and other add-on provided Content Types that support direct content restrictions.- Specified by:
- deleteAllDirectRestrictionsCompletionStagein interface- RemoteContentRestrictionService
- Parameters:
- target- the id of the content to remove all directly specified restrictions from
- expansions- the expansions to the ContentRestriction. To be expanded on response.
- Returns:
- ContentRestrictionsPageResponsedescribing the new state of the content identified by- contentId(same aswould return)- invalid reference- #getRestrictions(ContentId, PageRequest, Expansion...)
- Throws:
- ServiceException- or one of it subtypes.
 
- 
hasDirectRestrictionForSubjectCompletionStagepublic CompletionStage<Boolean> hasDirectRestrictionForSubjectCompletionStage(ContentId contentId, OperationKey operationKey, Subject subject) throws ServiceException Description copied from interface:RemoteContentRestrictionServiceReturnstrueif the User or Group specified by thesubjectparameter has restriction(s) for theoperationKeyoperation which are specified directly on the Content identified bycontentIdparameter.Returns falseotherwise.Can throw BadRequestExceptionorPermissionExceptionand other various subtypes ofServiceExceptionin case of bad IDs, parameters, permission problems, etc.- Specified by:
- hasDirectRestrictionForSubjectCompletionStagein interface- RemoteContentRestrictionService
- Parameters:
- contentId- the id of the content which the check will be performed on
- operationKey- the operation key to check restrictions against
- subject- either- Useror- Groupwho's restriction is in question
- Returns:
- trueor- falsedepending on whether user/group specified have any direct restrictions on a content specified
- Throws:
- ServiceException- or one of it subtypes.
 
- 
deleteDirectRestrictionForSubjectCompletionStagepublic CompletionStage<Void> deleteDirectRestrictionForSubjectCompletionStage(ContentId contentId, OperationKey operationKey, Subject subject) throws ServiceException Description copied from interface:RemoteContentRestrictionServiceDeletes singular directContentRestrictionforoperationKeyandsubjectfrom the content identified bycontentIdparameter. Throws subclasses ofServiceExceptionin case of various problems (cannot find content, restrictions to be deleted does not exist, etc...)- Specified by:
- deleteDirectRestrictionForSubjectCompletionStagein interface- RemoteContentRestrictionService
- Parameters:
- contentId- the id of the content which the restriction to be removed from
- operationKey- the operation to remove restriction for
- subject- either- Useror- Groupwho's restriction is to be deleted
- Throws:
- ServiceException
 
- 
addDirectRestrictionForSubjectCompletionStagepublic CompletionStage<Void> addDirectRestrictionForSubjectCompletionStage(ContentId contentId, OperationKey operationKey, Subject subject) throws ServiceException Description copied from interface:RemoteContentRestrictionServiceAdds singular directContentRestrictionforoperationKeyandsubjectto the content identified bycontentIdparameter. Throws subclasses ofServiceExceptionin case of various problems (cannot find content, wrong operationKey, restricting self, etc...)- Specified by:
- addDirectRestrictionForSubjectCompletionStagein interface- RemoteContentRestrictionService
- Parameters:
- contentId- the id of the content which the restriction to be added to
- operationKey- the operation to remove restriction for
- subject- either- Useror- Groupwho's restriction is to be added
- Throws:
- ServiceException
 
 
-