- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/user.php
- Класс: CAllSocNetUser
- Вызов: CAllSocNetUser::IsCurrentUserModuleAdmin
static function IsCurrentUserModuleAdmin($site_id = SITE_ID, $bUseSession = true)
{
global $APPLICATION, $USER;
static $cache = [];
if (!is_object($USER) || !$USER->IsAuthorized())
{
return false;
}
$result = $USER->isAdmin();
if (!$result)
{
$cacheKey = 'false';
if (is_array($site_id))
{
$cacheKey = serialize($cacheKey);
}
elseif ($site_id)
{
$cacheKey = $site_id;
}
else
{
$cacheKey = 'false';
}
if (isset($cache[$cacheKey]))
{
$result = $cache[$cacheKey];
}
else
{
if (is_array($site_id))
{
foreach ($site_id as $site_id_tmp)
{
$modulePerms = $APPLICATION->GetGroupRight("socialnetwork", false, "Y", "Y", array($site_id_tmp, false));
if ($modulePerms >= "W")
{
$result = true;
break;
}
}
}
else
{
$modulePerms = $APPLICATION->GetGroupRight("socialnetwork", false, "Y", "Y", ($site_id ? array($site_id, false) : false));
$result = ($modulePerms >= "W");
}
$cache[$cacheKey] = $result;
}
}
$result = (
$result
&& (
!$bUseSession
|| CSocNetUser::IsEnabledModuleAdmin()
)
);
return $result;
}