Class ContentRestrictionResource
java.lang.Object
com.atlassian.confluence.plugins.restapi.resources.ContentRestrictionResource
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyOperation
(ContentId id, String expand) Returns info about all restrictions by operationforOperation
(ContentId id, OperationKey opKey, String expand, int start, int limit) Returns info about all restrictions of given operationupdateRestrictions
(ContentId contentId, String expand, PageResponse<ContentRestriction> contentRestrictions) Sets all the restrictions specified to a piece of content identified bycontentId
, replacing any existing permissions.
-
Constructor Details
-
ContentRestrictionResource
-
-
Method Details
-
byOperation
Returns info about all restrictions by operation
- Parameters:
id
- the id of the contentexpand
- a comma separated list of properties to expand on the content properties. Default value: group.- Returns:
- a JSON representation of the restrictions group by operations
-
forOperation
@PublicApi public ContentRestriction forOperation(ContentId id, OperationKey opKey, String expand, int start, int limit) Returns info about all restrictions of given operation
- Parameters:
id
- the id of the contentopKey
- key of the operationexpand
- a comma separated list of properties to expand on the content properties. Default value: group.start
- pagination startlimit
- pagination limit- Returns:
- a JSON representation of the restrictions group by operations
-
updateRestrictions
@PublicApi public PageResponse<ContentRestriction> updateRestrictions(ContentId contentId, String expand, PageResponse<ContentRestriction> contentRestrictions) Sets 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.Example request URI:
http://example.com/confluence/rest/content/1234567/restriction?expand=
Accepts same input format as the response of GET to the same resource would return. For the sake of simplicity also allows stripping of
{"results": ... }"
part and inlining arrays of specific users/groups directly.E.g.
Example request (simplified)
[ { "operation": "update", "restrictions": { "user": [ { "type": "known", "username": "admin" } ] } } ]
Rules of applying restrictions via this method:
- Provided collection of
ContentRestriction
s is allowed to have only 1 (ONE)ContentRestriction
object 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 and BlogPost contents are supported.
- Parameters:
contentId
- content to set restrictions forexpand
- a coma separated list of properties to expand in the response. Default isrestrictions.user,restrictions.group
- Returns:
- the new state of the resource.
PageResponse
with all the restrictions which are specified directly on a Content. Result is the same as the response of GET to the same resource would return.
-