本文整理匯總了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]);
}
}