addGroupToSpacePermission

Syntax

addGroupToSpacePermission(permissionType, spaceKey, groupName)

Description

Adds a given group to a space permission if the group is not in that permission already.

Parameters

Parameter name

Type

Required

Description

permissionTypestringYesPermission type a group will be added to.
A list of values is provided in a table below.
spaceKeystringYesThe key of the space to add permission to.

groupName

stringYes

The name of a group to add in permission.


Valid space permission types

Permission typeDescription
USECONFLUENCEPermission to use Confluence.
LIMITEDUSECONFLUENCEPermission to limited usage of Confluence.
UPDATEUSERSTATUSPermission to update user status.
VIEWUSERPROFILESPermission to view user profiles.
SYSTEMADMINISTRATORPermission to be a system administrator.
ADMINISTRATECONFLUENCEPermission to be a Confluence administrator.
PERSONALSPACEPermission to work with personal space.
CREATESPACEPermission to create a space.
VIEWSPACEPermission to view a space.
REMOVEOWNCONTENTPermission to remove own content.
COMMENTPermission to add comments.
EDITSPACEPermission to edit a space.
SETSPACEPERMISSIONSPermission to update space permissions.
REMOVEPAGEPermission to remove a page.
REMOVECOMMENTPermission to remove a comment.
REMOVEBLOGPermission to remove a blog.
CREATEATTACHMENTPermission to create an attachment.
REMOVEATTACHMENTPermission to remove an attachment.
EDITBLOGPermission to edit a blog.
EXPORTSPACEPermission to export a space.
REMOVEMAILPermission to remove email.
SETPAGEPERMISSIONSPermission to update page permissions
PROFILEATTACHMENTSPermission to work with profile attachments.

Return type

boolean (true/false)

Returns true if space permission was actually changed by the routine invocation, i.e. a group was actually added to the specified space permission. Returns false if a space permission was not changed.

If the routine returns false, it doesn't mean that a group doesn't have the specified permission. It just means that the state of the space permission was not changed. For example, if the specified group was in the specified space permission before the routine invocation, the routine will return false, because the state of the space permission was not changed. In order to check if the specified group has a certain space permission please use the following routine: groupHasSpacePermission.

Example

Example 1

addGroupToSpacePermission("EDITSPACE", "PS-DOCS", "confluence-users");

Allows members of the group "confluence-users" to modify space with key "PS-DOCS".

See also