- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_perms.php
- Класс: \CCrmPerms
- Вызов: CCrmPerms::GetPermType
public function GetPermType($permEntity, $permType = 'READ', $arEntityAttr = array())
{
if (self::IsAdmin($this->userId))
return self::PERM_ALL;
if (!isset($this->arUserPerms[$permEntity][$permType]))
return self::PERM_NONE;
if($permType === 'READ'
&& (in_array(self::ATTR_READ_ALL, $arEntityAttr, true)
|| in_array('CU'.$this->userId, $arEntityAttr, true)
)
)
{
return self::PERM_ALL;
}
$icnt = count($this->arUserPerms[$permEntity][$permType]);
if ($icnt == 1 && isset($this->arUserPerms[$permEntity][$permType]['-']))
return $this->arUserPerms[$permEntity][$permType]['-'];
else if ($icnt > 1)
{
foreach ($this->arUserPerms[$permEntity][$permType] as $sField => $arFieldValue)
{
if ($sField == '-')
continue ;
foreach ($arFieldValue as $fieldValue => $sAttr)
{
if (in_array($sField.$fieldValue, $arEntityAttr))
return $sAttr;
}
}
return $this->arUserPerms[$permEntity][$permType]['-'];
}
else
return self::PERM_NONE;
}