Documentation

setOperationsForSite

Rights::setOperationsForSite(
   $siteId,
   $rights
);

Sets access permissions for a site. Returns true or an error. Method is available only for portal administrator and only for commercial cloud-based subscriptions.

Parameters

Class Description Available from version
id Site ID.
rights Object with access permissions with unique IDs as keys (for user, department, groups...), and values are the accessible operations:
  • denied – access denied (when setting up this access permission even as part of other permissions, other permissions are reset for specific object)
  • read – read access (automatically assigned by the system when additionally indicating any other access permission other than denied)
  • edit – edit access (for page content)
  • sett – setting edit access
  • public – publishing access
  • delete – deleting access (for removing to and restoring from recycle bin)

Access permissions are independent and can be assigned individually. For example, user can have only publishing access permission without any permission to edit.

The following values can be used as keys:

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

Example

if (\Bitrix\Main\Loader::includeModule('landing'))
{
   \Bitrix\Landing\Rights::setOperationsForSite($siteId, [
      'U3' => [
         'edit', 'delete'
      ],
      'U1' => [
         'edit', 'sett'
      ]
   ]);
}


© «Bitrix24», 2001-2024