Documentation

setAccessCodes

public static function Role::setAccessCodes(
   $id,
   $codes
);

Method sets access codes for a role (and its limits for sites). Retrieves role ID and access code array. When array is empty, codes for role will be reset.

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.

Parameters

ParameterDescriptionVersion
idRole ID.
codesAccess code array.

Examples

if (\Bitrix\Main\Loader::includeModule('landing'))
{
   \Bitrix\Landing\Role::setAccessCodes(11, array (
      'SG3_A',
      'G4'
   ));
}


© «Bitrix24», 2001-2024