CCrmRole::SetRoleRelation

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

	$this->log('SetRoleRelation', ['ID' => $ID, 'RELATION' => $arRelation]);

	$sSql = 'DELETE FROM b_crm_role_perms WHERE ROLE_ID = '.$ID;
	$DB->Query($sSql, false, 'FILE: '.__FILE__.'
LINE: '.__LINE__); foreach ($arRelation as $sEntity => $arPerms) { foreach ($arPerms as $sPerm => $arFields) { foreach ($arFields as $sField => $arFieldValue) { if ($sField == '-') { $arFieldValue = trim($arFieldValue); if ($arFieldValue != '-') { $arInsert = array(); $arInsert['ROLE_ID'] = $ID; $arInsert['ENTITY'] = $sEntity; $arInsert['FIELD'] = '-'; $arInsert['PERM_TYPE'] = $sPerm; $arInsert['ATTR'] = $arFieldValue; $DB->Add('b_crm_role_perms', $arInsert, array(), 'FILE: '.__FILE__.'
LINE: '.__LINE__); } } else { foreach ($arFieldValue as $fieldValue => $sAttr) { $sAttr = trim($sAttr); if ($sAttr != '-') { $arInsert = array(); $arInsert['ROLE_ID'] = $ID; $arInsert['ENTITY'] = $sEntity; $arInsert['FIELD'] = $sField; $arInsert['FIELD_VALUE'] = $fieldValue; $arInsert['PERM_TYPE'] = $sPerm; $arInsert['ATTR'] = $sAttr; $DB->Add('b_crm_role_perms', $arInsert, array(), 'FILE: '.__FILE__.'
LINE: '.__LINE__); } } } } } } self::ClearCache(); }

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