CCrmRole::GetCalculateRolePermsByRelation

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmRole
  4. GetCalculateRolePermsByRelation
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_role.php
  • Класс: \CCrmRole
  • Вызов: CCrmRole::GetCalculateRolePermsByRelation
public function GetCalculateRolePermsByRelation($arRel)
{
	global $DB;
	static $arResult = array();

	if (empty($arRel))
		return $arRel;

	foreach ($arRel as &$sRel)
		$sRel = $DB->ForSql(mb_strtoupper($sRel));
	$sin = implode("','", $arRel);

	if (isset($arResult[$sin]))
		return $arResult[$sin];

	$sSql = "
		SELECT RP.*
		FROM b_crm_role_perms RP, b_crm_role_relation RR
		WHERE RP.ROLE_ID = RR.ROLE_ID AND RR.RELATION IN('$sin')";
	$obRes = $DB->Query($sSql, false, 'FILE: '.__FILE__.'
LINE: '.__LINE__); $_arResult = array(); while ($arRow = $obRes->Fetch()) { $arRow['ATTR'] = trim($arRow['ATTR']); if ($arRow['FIELD'] == '-') { if (!isset($_arResult[$arRow['ENTITY']][$arRow['PERM_TYPE']][$arRow['FIELD']]) || $arRow['ATTR'] > $_arResult[$arRow['ENTITY']][$arRow['PERM_TYPE']][$arRow['FIELD']]) $_arResult[$arRow['ENTITY']][$arRow['PERM_TYPE']][$arRow['FIELD']] = $arRow['ATTR']; } else if (!isset($_arResult[$arRow['ENTITY']][$arRow['PERM_TYPE']][$arRow['FIELD']][$arRow['FIELD_VALUE']]) || $arRow['ATTR'] > $_arResult[$arRow['ENTITY']][$arRow['PERM_TYPE']][$arRow['FIELD']][$arRow['FIELD_VALUE']]) $_arResult[$arRow['ENTITY']][$arRow['PERM_TYPE']][$arRow['FIELD']][$arRow['FIELD_VALUE']] = $arRow['ATTR']; } $arResult[$sin] = $_arResult; return $_arResult; }

Добавить комментарий