本文整理汇总了PHP中CIBlockRights::_mk_result方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockRights::_mk_result方法的具体用法?PHP CIBlockRights::_mk_result怎么用?PHP CIBlockRights::_mk_result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockRights
的用法示例。
在下文中一共展示了CIBlockRights::_mk_result方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _check_if_user_has_right
static function _check_if_user_has_right($obRights, $ID, $permission, $flags = 0)
{
global $DB, $USER;
$USER_ID = 0;
if($USER_ID > 0 && (!is_object($USER) || $USER_ID != $USER->GetID()))
{
$user_id = intval($USER_ID);
$arGroups = CUser::GetUserGroup($USER_ID);
if(
in_array(1, $arGroups)
&& COption::GetOptionString("main", "controller_member", "N") != "Y"
&& COption::GetOptionString("main", "~controller_limited_admin", "N") != "Y"
)
{
return CIBlockRights::_mk_result($ID, CIBlockRights::LetterToOperations("X"), true, $flags);
}
}
elseif(!is_object($USER))
{
return CIBlockRights::_mk_result($ID, array(), false, $flags);
}
elseif($USER->IsAdmin())
{
return CIBlockRights::_mk_result($ID, CIBlockRights::LetterToOperations("X"), true, $flags);
}
$user_id = intval($USER->GetID());
$arGroups = $USER->GetUserGroupArray();
$RIGHTS_MODE = CIBlock::GetArrayByID($obRights->GetIBlockID(), "RIGHTS_MODE");
if($RIGHTS_MODE === "E")
{
static $Ecache;
if(is_array($ID))
$arOperations = $obRights->GetUserOperations($ID, $user_id);
else
{
$cache_id = $user_id."|".$ID;
if(!isset($Ecache[$cache_id]))
$Ecache[$cache_id] = $obRights->GetUserOperations($ID, $user_id);
$arOperations = $Ecache[$cache_id];
}
if($flags & CIBlockRights::RETURN_OPERATIONS)
return $arOperations;
else
return isset($arOperations[$permission]);
}
else//if($RIGHTS_MODE === "S")
{
$letter = CIBlock::GetPermission($obRights->GetIBlockID());
$arOperations = CIBlockRights::_mk_result($ID, CIBlockRights::LetterToOperations($letter), CIBlockRights::LetterToOperations($letter), $flags);
if($flags & CIBlockRights::RETURN_OPERATIONS)
return $arOperations;
else
return isset($arOperations[$permission]);
}
}