@ExperimentalApi
public interface ContentRestrictionService
Modifier and Type | Interface and Description |
---|---|
static interface |
ContentRestrictionService.Validator
Validator interface.
|
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_BY_OPERATION_EXPANSIONS |
static String |
DEFAULT_FOR_OPERATION_AND_CONTENT_EXPANSIONS |
static String |
DEFAULT_FOR_OPERATION_EXPANSIONS |
Modifier and Type | Method and Description |
---|---|
void |
addDirectRestrictionForSubject(ContentId contentId,
OperationKey operationKey,
Subject subject)
Adds singular direct
ContentRestriction for operationKey and subject to the content identified by contentId parameter. |
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 . |
ContentRestrictionsPageResponse |
deleteAllDirectRestrictions(ContentId target,
Expansion... expansions)
Attempts to delete all the restrictions specified directly on a piece of content identified by
contentId . |
void |
deleteDirectRestrictionForSubject(ContentId contentId,
OperationKey operationKey,
Subject subject)
Deletes singular direct
ContentRestriction for operationKey and subject from the content identified by contentId parameter. |
ContentRestrictionsPageResponse |
getRestrictions(ContentId target,
PageRequest pageRequest,
Expansion... expansions)
Retrieves all the restrictions for all the operations on a given Content.
|
ContentRestriction |
getRestrictionsForOperation(ContentId target,
OperationKey operationKey,
PageRequest pageRequest,
Expansion... expansions)
Retrieves all restrictions for given operation key on given content.
|
Map<OperationKey,ContentRestriction> |
getRestrictionsGroupByOperation(ContentId target,
Expansion... expansions)
List all restrictions that exist directly on the given content.
|
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. |
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. |
ContentRestrictionService.Validator |
validator() |
static final String DEFAULT_BY_OPERATION_EXPANSIONS
static final String DEFAULT_FOR_OPERATION_EXPANSIONS
static final String DEFAULT_FOR_OPERATION_AND_CONTENT_EXPANSIONS
ContentRestrictionService.Validator validator()
ContentRestrictionService.Validator
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.NotFoundException
- if given content id does not exist, or is not viewable by userServiceException
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.NotFoundException
- if given content id does not exist, or is not viewable by user, or if the given operation key is not recognised for the content.ServiceException
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 userContentRestrictionsPageResponse 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.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.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 specifiedboolean 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 itvoid 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
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.