當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CIBlockRights::_mk_result方法代碼示例

本文整理匯總了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]);
		}
	}
開發者ID:ASDAFF,項目名稱:bxApiDocs,代碼行數:61,代碼來源:iblock_rights.php


注:本文中的CIBlockRights::_mk_result方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。