@ExperimentalApi
public interface RemoteContentRestrictionService
ContentRestrictionService
implementation that communicates with Confluence remotely using the Confluence REST API.
Provides future returning equivalents for the methods in ContentRestrictionService.
Modifier and Type | Method and Description |
---|---|
com.atlassian.util.concurrent.Promise<Void> |
addDirectRestrictionForSubject(ContentId contentId,
OperationKey operationKey,
Subject subject)
Adds singular direct
ContentRestriction for operationKey and subject to the content identified by contentId parameter. |
com.atlassian.util.concurrent.Promise<ContentRestrictionsPageResponse> |
addRestrictions(ContentId target,
Collection<? extends ContentRestriction> contentRestrictions,
Expansion... expansions)
Attempts to add all the restrictions specified to a piece of content identified by
contentId . |
com.atlassian.util.concurrent.Promise<ContentRestrictionsPageResponse> |
deleteAllDirectRestrictions(ContentId target,
Expansion... expansions)
Attempts to delete all the restrictions specified directly on a piece of content identified by
contentId . |
com.atlassian.util.concurrent.Promise<Void> |
deleteDirectRestrictionForSubject(ContentId contentId,
OperationKey operationKey,
Subject subject)
Deletes singular direct
ContentRestriction for operationKey and subject from the content identified by contentId parameter. |
com.atlassian.util.concurrent.Promise<ContentRestrictionsPageResponse> |
getRestrictions(ContentId target,
PageRequest pageRequest,
Expansion... expansions)
Retrieves all the restrictions for all the operations on a given Content.
|
com.atlassian.util.concurrent.Promise<ContentRestriction> |
getRestrictionsForOperation(ContentId target,
OperationKey operationKey,
PageRequest pageRequest,
Expansion... expansions)
Retrieves all restrictions for given operation key on given content.
|
com.atlassian.util.concurrent.Promise<Map<OperationKey,ContentRestriction>> |
getRestrictionsGroupByOperation(ContentId target,
Expansion... expansions)
List all restrictions that exist directly on the given content.
|
com.atlassian.util.concurrent.Promise<Boolean> |
hasDirectRestrictionForSubject(ContentId contentId,
OperationKey operationKey,
Subject subject)
Returns
true if the User or Group specified by the subject parameter has restriction(s) for the operationKey operation
which are specified directly on the Content identified by contentId parameter. |
com.atlassian.util.concurrent.Promise<ContentRestrictionsPageResponse> |
updateRestrictions(ContentId target,
Collection<? extends ContentRestriction> contentRestrictions,
Expansion... expansions)
Sets all the restrictions specified to a piece of content identified by
contentId , replacing any existing permissions. |
com.atlassian.util.concurrent.Promise<Map<OperationKey,ContentRestriction>> getRestrictionsGroupByOperation(ContentId target, Expansion... expansions) throws ServiceException
getRestrictionsForOperation(com.atlassian.confluence.api.model.content.id.ContentId, com.atlassian.confluence.api.model.permissions.OperationKey, com.atlassian.confluence.api.model.pagination.PageRequest, com.atlassian.confluence.api.model.Expansion...)
method.target
- the id of the content to look up permissions forexpansions
- the expansions to apply to the returned data. These expansions start from the operation itself.ServiceException
com.atlassian.util.concurrent.Promise<ContentRestriction> getRestrictionsForOperation(ContentId target, OperationKey operationKey, PageRequest pageRequest, Expansion... expansions) throws ServiceException
target
- the id of the content to look up permissions foroperationKey
- the operation key to look up restrictions forpageRequest
- pagination through the subjects contained within the ContentRestrictionexpansions
- the expansions to the ContentRestriction.ServiceException
com.atlassian.util.concurrent.Promise<ContentRestrictionsPageResponse> getRestrictions(ContentId target, PageRequest pageRequest, Expansion... expansions) throws NotFoundException
target
- the id of the content to look up permissions forpageRequest
- pagination through the list of all the ContentRestrictions returnedexpansions
- the expansions to the ContentRestrictionNotFoundException
- if given content id does not exist, or is not viewable by usercom.atlassian.util.concurrent.Promise<ContentRestrictionsPageResponse> updateRestrictions(ContentId target, Collection<? extends ContentRestriction> contentRestrictions, Expansion... expansions) throws ServiceException
contentId
, replacing any existing permissions.
Setting per-content restrictions is currently allowed for Pages or BlogPosts only.
Rules of applying restrictions via this method:
ContentRestriction
s is allowed to have only 1 (ONE) ContentRestriction
object for each operation.target
- the id of the content to assign restrictions tocontentRestrictions
- Collection of ContentRestriction
s to apply to the Content specifiedexpansions
- the expansions to the ContentRestriction. To be expanded on response.ContentRestrictionsPageResponse
describing the new state of the content identified by contentId
(same as getRestrictions(ContentId, PageRequest, Expansion...)
would return)ServiceException
- or one of it subtypes.NotFoundException
- in case there's no Content with ID provided or user does not have enough rights to view itPermissionException
- in case user is not allowed to alter restrictions on the content specifiedBadRequestException
- in case when data supplied is not enough/corrupt, etc... many reasons. Exception generally would have message which explains what's wrong.com.atlassian.util.concurrent.Promise<ContentRestrictionsPageResponse> addRestrictions(ContentId target, Collection<? extends ContentRestriction> contentRestrictions, Expansion... expansions) throws ServiceException
contentId
.
Does not replace/remove/alter any pre-existing ContentRestriction
s.
Provided ContentRestriction
s 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:
ContentRestriction
s is allowed to have only 1 (ONE) ContentRestriction
object for each operation.target
- the id of the content to add restrictions tocontentRestrictions
- Collection of ContentRestriction
s to apply to the Content specifiedexpansions
- the expansions to the ContentRestriction. To be expanded on response.ContentRestrictionsPageResponse
describing the new state of the content identified by contentId
(same as getRestrictions(ContentId, PageRequest, Expansion...)
would return)ServiceException
- or one of it subtypes.NotFoundException
- in case there's no Content with ID provided or user does not have enough rights to view itPermissionException
- in case user is not allowed to alter restrictions on the content specifiedBadRequestException
- in case when data supplied is not enough/corrupt, etc... many reasons. Exception generally would have message which explains what's wrong.com.atlassian.util.concurrent.Promise<ContentRestrictionsPageResponse> deleteAllDirectRestrictions(ContentId target, Expansion... expansions) throws ServiceException
contentId
.
"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.target
- the id of the content to remove all directly specified restrictions fromexpansions
- the expansions to the ContentRestriction. To be expanded on response.ContentRestrictionsPageResponse
describing the new state of the content identified by contentId
(same as getRestrictions(ContentId, PageRequest, Expansion...)
would return)ServiceException
- or one of it subtypes.NotFoundException
- in case there's no Content with ID provided or user does not have enough rights to view itPermissionException
- in case user is not allowed to alter restrictions on the content specifiedcom.atlassian.util.concurrent.Promise<Boolean> hasDirectRestrictionForSubject(ContentId contentId, OperationKey operationKey, Subject subject) throws ServiceException
true
if the User or Group specified by the subject
parameter has restriction(s) for the operationKey
operation
which are specified directly on the Content identified by contentId
parameter.
Returns false
otherwise.
Can throw BadRequestException
or PermissionException
and other various subtypes of ServiceException
in case of bad IDs, parameters, permission problems, etc.
contentId
- the id of the content which the check will be performed onoperationKey
- the operation key to check restrictions againstsubject
- either User
or Group
who's restriction is in questiontrue
or false
depending on whether user/group specified have any direct restrictions on a content specifiedServiceException
- or one of it subtypes.NotFoundException
- in case there's no Content with ID provided or user does not have enough rights to view itcom.atlassian.util.concurrent.Promise<Void> deleteDirectRestrictionForSubject(ContentId contentId, OperationKey operationKey, Subject subject) throws ServiceException
ContentRestriction
for operationKey
and subject
from the content identified by contentId
parameter.
Throws subclasses of ServiceException
in case of various problems (cannot find content, restrictions to be deleted does not exist, etc...)contentId
- the id of the content which the restriction to be removed fromoperationKey
- the operation to remove restriction forsubject
- either User
or Group
who's restriction is to be deletedServiceException
com.atlassian.util.concurrent.Promise<Void> addDirectRestrictionForSubject(ContentId contentId, OperationKey operationKey, Subject subject) throws ServiceException
ContentRestriction
for operationKey
and subject
to the content identified by contentId
parameter.
Throws subclasses of ServiceException
in case of various problems (cannot find content, wrong operationKey, restricting self, etc...)contentId
- the id of the content which the restriction to be added tooperationKey
- the operation to remove restriction forsubject
- either User
or Group
who's restriction is to be addedServiceException
Copyright © 2003–2017 Atlassian. All rights reserved.