Documentation

getOperationsName

array public static
\Bitrix\Highloadblock\HighloadBlockRightsTable::getOperationsName(
 integer|array $hlId
);

Checks access permissions for a highload block for the current user. Static method.

Parameters

ParameterDescriptionVersion
$hlIdhighload block identifier (or array of IDs) .

Returned values

When method returns an empty array, it means that the current user doesn't have any permissions for this specified highload block (or highload blocks).

When returned array is not empty, it may consist of the following values:

  • hblock_denied - access denied;
  • hblock_read - read access allowed;
  • hblock_write - write access allowed.

If array has a specific key, determines specific available user access permissions for indicated highload block.

Example

$id = 1;
$rights = \Bitrix\HighloadBlock\HighloadBlockRightsTable::getOperationsName($id);
echo 'На highload block#'.$id.' permissions available: '.PHP_EOL;
if (in_array('hblock_write', $rights))
{
    echo 'to write'.PHP_EOL;
}
elseif (in_array('hblock_read', $rights))
{
    echo 'to read'.PHP_EOL;
}
elseif (empty($rights))
{
    echo 'no permissions...'.PHP_EOL;
}


© «Bitrix24», 2001-2024
Up