public class RemoteContentRestrictionServiceImpl extends AbstractRemoteService<ContentRestrictionService> implements RemoteContentRestrictionService
Constructor and Description |
---|
RemoteContentRestrictionServiceImpl(AuthenticatedWebResourceProvider provider,
com.google.common.util.concurrent.ListeningExecutorService executor) |
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. |
addExpansions, addPageRequest, addPageRequestParams, deleteFuture, deleteFuture, getFuture, getFutureGenericCollection, getFutureMap, getFutureMapOfPageResponses, getFutureOption, getFuturePageResponseList, newExperimentalRestWebResource, newRestWebResource, postFuture, postFuture, postFuture, postFutureToPageResponse, putFuture
public RemoteContentRestrictionServiceImpl(AuthenticatedWebResourceProvider provider, com.google.common.util.concurrent.ListeningExecutorService executor)
public com.atlassian.util.concurrent.Promise<Map<OperationKey,ContentRestriction>> getRestrictionsGroupByOperation(ContentId target, Expansion... expansions) throws ServiceException
RemoteContentRestrictionService
RemoteContentRestrictionService.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.getRestrictionsGroupByOperation
in interface RemoteContentRestrictionService
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
public com.atlassian.util.concurrent.Promise<ContentRestriction> getRestrictionsForOperation(ContentId target, OperationKey operationKey, PageRequest pageRequest, Expansion... expansions) throws ServiceException
RemoteContentRestrictionService
getRestrictionsForOperation
in interface RemoteContentRestrictionService
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
public com.atlassian.util.concurrent.Promise<ContentRestrictionsPageResponse> getRestrictions(ContentId target, PageRequest pageRequest, Expansion... expansions) throws NotFoundException
RemoteContentRestrictionService
getRestrictions
in interface RemoteContentRestrictionService
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 userpublic com.atlassian.util.concurrent.Promise<ContentRestrictionsPageResponse> updateRestrictions(ContentId target, Collection<? extends ContentRestriction> contentRestrictions, Expansion... expansions) throws ServiceException
RemoteContentRestrictionService
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.updateRestrictions
in interface RemoteContentRestrictionService
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 RemoteContentRestrictionService.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.public com.atlassian.util.concurrent.Promise<ContentRestrictionsPageResponse> addRestrictions(ContentId target, Collection<? extends ContentRestriction> contentRestrictions, Expansion... expansions) throws ServiceException
RemoteContentRestrictionService
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.addRestrictions
in interface RemoteContentRestrictionService
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 RemoteContentRestrictionService.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.public com.atlassian.util.concurrent.Promise<ContentRestrictionsPageResponse> deleteAllDirectRestrictions(ContentId target, Expansion... expansions) throws ServiceException
RemoteContentRestrictionService
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.deleteAllDirectRestrictions
in interface RemoteContentRestrictionService
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 RemoteContentRestrictionService.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 specifiedpublic com.atlassian.util.concurrent.Promise<Boolean> hasDirectRestrictionForSubject(ContentId contentId, OperationKey operationKey, Subject subject) throws ServiceException
RemoteContentRestrictionService
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.
hasDirectRestrictionForSubject
in interface RemoteContentRestrictionService
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 itpublic com.atlassian.util.concurrent.Promise<Void> deleteDirectRestrictionForSubject(ContentId contentId, OperationKey operationKey, Subject subject) throws ServiceException
RemoteContentRestrictionService
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...)deleteDirectRestrictionForSubject
in interface RemoteContentRestrictionService
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
public com.atlassian.util.concurrent.Promise<Void> addDirectRestrictionForSubject(ContentId contentId, OperationKey operationKey, Subject subject) throws ServiceException
RemoteContentRestrictionService
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...)addDirectRestrictionForSubject
in interface RemoteContentRestrictionService
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–2018 Atlassian. All rights reserved.