Documentation

landing.site.setRights

Scope: catalog Permissions to execute: administrator

The method sets access permissions for site. Returns true or an error. The method is available for an account administrator only, including the Bitrix24 Cloud accounts for commercial subscriptions only.

Parameters

Parameter Description Available from version
id Site identifier.
rights Object with access permissions. Object keys are unique IDs (user IDs, department and group IDs, etc.), and the following available operations - are values:

  • denied – access denied (when this permission is set - all other defined access permissions are reset for a specific object)
  • read – read (access permission is automatically set by the system in addition when specifying any other permission than 'denied')
  • edit – edit (landing page content),
  • sett – set settings,
  • public – publish,
  • delete – delete (to trash bin as well as restore from recycle bin).

Access permissions are independent and can be granted selectively. For example, user can have only access permission to publish without option to do any edits.

The following values can be used as keys:

  • SG - workgroup, for example SG1 - workgroup with ID 2;
  • U - user, for example U45 - user with ID 45;
  • DR - department, including subdepartments, for example DR23 - section with ID 23;
  • UA - all authorized users.
  • G - user group, including subdepartments, for example DR23 - section with 23.

Example

BX24.callMethod(
   'landing.site.setRights',
   {
      id: 645,
      rights: {
         'U3': [
            'edit', 'delete'
         ],
         'U1': [
            'edit', 'sett'
         ]
      }
   },
   function(result)
   {
      if(result.error())
      {
         console.error(result.error());
      }
      else
      {
         console.info(result.data());
      }
   }
);


© «Bitrix24», 2001-2024