Class ContentRestrictionResource
- java.lang.Object
-
- com.atlassian.confluence.plugins.restapi.resources.ContentRestrictionResource
-
public class ContentRestrictionResource extends Object
-
-
Constructor Summary
Constructors Constructor Description ContentRestrictionResource(ContentRestrictionService service)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<OperationKey,ContentRestriction>
byOperation(ContentId id, String expand)
Returns info about all restrictions by operationContentRestriction
forOperation(ContentId id, OperationKey opKey, String expand, int start, int limit)
Returns info about all restrictions of given operationPageResponse<ContentRestriction>
updateRestrictions(ContentId contentId, String expand, List<ContentRestriction> contentRestrictions)
Sets all the restrictions specified to a piece of content identified bycontentId
, replacing any existing permissions.
-
-
-
Constructor Detail
-
ContentRestrictionResource
public ContentRestrictionResource(ContentRestrictionService service)
-
-
Method Detail
-
byOperation
@PublicApi public Map<OperationKey,ContentRestriction> byOperation(ContentId id, String expand)
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, List<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=
The payload uses the same schema as returned by the GET requests from
/rest/api/content/{id}/restriction/byOperation*
which can be used as a template but is not necessary.Note that the required keys are operation and restrictions.
E.g.
Example request for a single content restriction:
[ { "operation": "update", "restrictions": { "user": [ { "type": "known", "username": "admin" } ] } } ]
Example request for updating two ContentRestrictions:
[ { "operation": "update", "restrictions": { "user": [ { "type": "known", "username": "admin" } ] } }, { "operation": "read", "restrictions": { "user": [ { "type": "known", "username": "fred" } ] } } ]
Rules for using this method:
- The provided ContentRestrictions will overwrite any existing restrictions on the Content for the corresponding operations.
- If the provided
ContentRestriction
lacks any supported operations, the restrictions for the operations will not be altered.- Setting "users" and/or "groups" map entries as empty arrays will remove the corresponding content restrictions.
- Missing "users" and/or "groups" map entries means the corresponding operation's user/group content restrictions won't be changed.
- Modifying restrictions to revoke the requesting user's access is prohibited.
- Parameters:
contentId
- content to set restrictions forexpand
- A comma 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.
-
-