Skip to end of banner
Go to start of banner

addUserToContentPermission

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Syntax

addUserToContentPermission(permissionType, pageId, userNameOrKey)

Description

 Adds a single user to a content permission if the user is not already in that permission.

Parameters

Parameter name

Type

Required

Description

permissionTypestringYesPermission type a user will be added to. A list of values is provided below.
pageIdnumberYesThe ID of the page to add permission to.

userNameOrKey

stringYesUser name or key of a user to add in permission.

Valid content permission types

Permission typeDescription
ViewPermission to view content.
EditPermission to edit content.

Return type

boolean (true/false)

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

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

Example

Example 1

addUserToContentPermission("Edit", 11508, "jdoe");

Allows user "jdoe" to modify page with id 11508.

See also

  • No labels