当前位置: 首页>>代码示例>>PHP>>正文


PHP CIBlock::GetPermission方法代码示例

本文整理汇总了PHP中CIBlock::GetPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::GetPermission方法的具体用法?PHP CIBlock::GetPermission怎么用?PHP CIBlock::GetPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIBlock的用法示例。


在下文中一共展示了CIBlock::GetPermission方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: AddProduct

 function AddProduct($NAME)
 {
     $iblock_permission = CIBlock::GetPermission(IBLOCK_ID);
     if ($iblock_permission < "W") {
         $GLOBALS["USER"]->RequiredHTTPAuthBasic();
         return new CSOAPFault('Server Error', 'Unable to authorize user.');
     }
     $code = self::translit($NAME);
     $i = 1;
     while (true) {
         $res = CIBlockElement::Getlist(array(), array("CODE" => $code), false, array("CODE"));
         if ($res->Fetch()) {
             $code = self::translit($NAME) . $i;
         } else {
             break;
         }
         $i++;
     }
     $arFields = array("IBLOCK_ID" => IBLOCK_ID, "NAME" => $NAME);
     $ib_element = new CIBlockElement();
     $result = $ib_element->Add($arFields);
     if ($result > 0) {
         return $result;
     }
     return new CSOAPFault('Server Error', 'Error: ' . $ib_element->LAST_ERROR);
 }
开发者ID:doppler324,项目名称:componentforworkingwithbitrix,代码行数:26,代码来源:HelperProduct.php

示例2: GetIBlockCatalog

 function GetIBlockCatalog()
 {
     $iblock_permission = CIBlock::GetPermission(IBLOCK_ID);
     if ($iblock_permission < "W") {
         $GLOBALS["USER"]->RequiredHTTPAuthBasic();
         return new CSOAPFault('Server Error', 'Unable to authorize user.');
     }
     $result = IBLOCK_ID;
     return $result;
     return new CSOAPFault('Server Error', 'Error');
 }
开发者ID:doppler324,项目名称:componentforworkingwithbitrix,代码行数:11,代码来源:HelperIblock.php

示例3: GetProperties

 function GetProperties()
 {
     $iblock_permission = CIBlock::GetPermission(IBLOCK_ID);
     if ($iblock_permission < "W") {
         $GLOBALS["USER"]->RequiredHTTPAuthBasic();
         return new CSOAPFault('Server Error', 'Unable to authorize user.');
     }
     if ($result > 0) {
         return $result;
     }
     return new CSOAPFault('Server Error', 'Error: Свойства не получены');
 }
开发者ID:doppler324,项目名称:componentforworkingwithbitrix,代码行数:12,代码来源:HelperProperty.php

示例4: GetCategory

 function GetCategory()
 {
     $iblock_permission = CIBlock::GetPermission(IBLOCK_ID);
     if ($iblock_permission < "W") {
         $GLOBALS["USER"]->RequiredHTTPAuthBasic();
         return new CSOAPFault('Server Error', 'Unable to authorize user.');
     }
     $res = CIBlockSection::GetList(array('LEFT_MARGIN' => 'ASC'), array("IBLOCK_ID" => IBLOCK_ID), false, array("ID", "NAME", "DEPTH_LEVEL"));
     $result = array();
     while ($arres = $res->GetNext()) {
         $result[] = array("ID" => $arres['ID'], "NAME" => $arres['NAME'], "DEPTH_LEVEL" => $arres['DEPTH_LEVEL']);
     }
     if (count($result) > 0) {
         return $result;
     }
     return new CSOAPFault('Server Error', 'Error: Нет ни одной категории');
 }
开发者ID:doppler324,项目名称:componentforworkingwithbitrix,代码行数:17,代码来源:HelperSection.php

示例5: CheckElementOperation

 public static function CheckElementOperation($intIBlockID, $intElementID, $strOperation, $strAccess)
 {
     $intIBlockID = intval($intIBlockID);
     if ($intIBlockID <= 0) {
         return false;
     }
     $intElementID = intval($intElementID);
     if ($intElementID <= 0) {
         return false;
     }
     if (!self::$boolCheck) {
         self::CheckExtRights();
     }
     if (self::$boolExtRights) {
         return CIBlockElementRights::UserHasRightTo($intIBlockID, $intElementID, $strOperation);
     } else {
         return CIBlock::GetPermission($intIBlockID) >= $strAccess;
     }
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:19,代码来源:iblock_rights.php

示例6: ValidateProperties

 public static function ValidateProperties($arTestProperties = array(), CBPWorkflowTemplateUser $user = null)
 {
     $arErrors = array();
     if (!array_key_exists("AbsenceUser", $arTestProperties) || count($arTestProperties["AbsenceUser"]) <= 0) {
         $arErrors[] = array("code" => "NotExist", "parameter" => "AbsenceUser", "message" => GetMessage("BPSNMA_EMPTY_ABSENCEUSER"));
     }
     if (!array_key_exists("AbsenceName", $arTestProperties) || count($arTestProperties["AbsenceName"]) <= 0) {
         $arErrors[] = array("code" => "NotExist", "parameter" => "AbsenceName", "message" => GetMessage("BPSNMA_EMPTY_ABSENCENAME"));
     }
     if (!array_key_exists("AbsenceFrom", $arTestProperties) || strlen($arTestProperties["AbsenceFrom"]) <= 0) {
         $arErrors[] = array("code" => "NotExist", "parameter" => "AbsenceFrom", "message" => GetMessage("BPSNMA_EMPTY_ABSENCEFROM"));
     }
     if (!array_key_exists("AbsenceTo", $arTestProperties) || strlen($arTestProperties["AbsenceTo"]) <= 0) {
         $arErrors[] = array("code" => "NotExist", "parameter" => "AbsenceTo", "message" => GetMessage("BPSNMA_EMPTY_ABSENCETO"));
     }
     $absenceIblockId = COption::GetOptionInt("intranet", 'iblock_absence', 0);
     $iblockPerm = CIBlock::GetPermission($absenceIblockId);
     if ($iblockPerm < "W") {
         $arErrors[] = array("code" => "perm", "message" => GetMessage("BPAA2_NO_PERMS"));
     }
     return array_merge($arErrors, parent::ValidateProperties($arTestProperties, $user));
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:22,代码来源:absenceactivity.php

示例7: getProductAvailableQuantity

 /**
  * @param $productId
  * @param null $userId
  * @return bool
  * @throws Main\ArgumentException
  */
 public static function getProductAvailableQuantity($productId, $userId = null)
 {
     $adminSection = defined('ADMIN_SECTION') && ADMIN_SECTION === true;
     $userId = isset($userId) ? (int) $userId : 0;
     if ($userId < 0) {
         $userId = 0;
     }
     static $arUserCache = array();
     if ($adminSection) {
         if ($userId == 0) {
             return false;
         }
         if (!isset($arUserCache[$userId])) {
             $userIterator = Main\UserTable::getList(array('select' => array('ID'), 'filter' => array('=ID' => $userId)));
             if ($userDat = $userIterator->fetch()) {
                 $userDat['ID'] = (int) $userDat['ID'];
                 $arUserCache[$userDat['ID']] = CUser::GetUserGroup($userDat['ID']);
             } else {
                 return false;
             }
         }
         $dbIBlockElement = CIBlockElement::GetList(array(), array('ID' => $productId, 'ACTIVE' => 'Y', 'ACTIVE_DATE' => 'Y', 'CHECK_PERMISSION' => 'N'), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL'));
         if (!($arProduct = $dbIBlockElement->GetNext())) {
             return false;
         }
         $iblockRights = null;
         if (!($iblockRights = static::getHitCache('IBLOCK_RIGHT', $arProduct['IBLOCK_ID']))) {
             if ($iblockRights = CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'RIGHTS_MODE')) {
                 static::setHitCache('IBLOCK_RIGHT', $arProduct['IBLOCK_ID'], $iblockRights);
             }
         }
         if ($iblockRights == 'E') {
             $proxyUserPermissionKey = $productId . "|" . $userId;
             if (!($arUserRights = static::getHitCache('USER_RIGHT', $proxyUserPermissionKey))) {
                 if ($arUserRights = CIBlockElementRights::GetUserOperations($productId, $userId)) {
                     static::setHitCache('USER_RIGHT', $proxyUserPermissionKey, $arUserRights);
                 }
             }
             if (empty($arUserRights) || !isset($arUserRights['element_read'])) {
                 return false;
             }
             unset($arUserRights);
         } else {
             if (CIBlock::GetPermission($arProduct['IBLOCK_ID'], $userId) < 'R') {
                 return false;
             }
         }
     } else {
         $dbIBlockElement = CIBlockElement::GetList(array(), array('ID' => $productId, 'ACTIVE' => 'Y', 'ACTIVE_DATE' => 'Y', 'CHECK_PERMISSIONS' => 'Y', 'MIN_PERMISSION' => 'R'), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL'));
         if (!($arProduct = $dbIBlockElement->GetNext())) {
             return false;
         }
     }
     $rsProducts = CCatalogProduct::GetList(array(), array('ID' => $productId), false, false, array('ID', 'QUANTITY'));
     if ($arCatalogProduct = $rsProducts->Fetch()) {
         return $arCatalogProduct['QUANTITY'];
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:65,代码来源:product_provider.php

示例8: GetMeetingRoomById

 public static function GetMeetingRoomById($Params)
 {
     if (IntVal($Params['RMiblockId']) > 0 && CIBlock::GetPermission($Params['RMiblockId']) >= "R") {
         $arFilter = array("IBLOCK_ID" => $Params['RMiblockId'], "ACTIVE" => "Y", "ID" => $Params['id']);
         $arSelectFields = array("NAME");
         $res = CIBlockSection::GetList(array(), $arFilter, false, array("NAME"));
         if ($arMeeting = $res->GetNext()) {
             return $arMeeting;
         }
     }
     if (IntVal($Params['VMiblockId']) > 0 && CIBlock::GetPermission($Params['VMiblockId']) >= "R") {
         $arFilter = array("IBLOCK_ID" => $Params['VMiblockId'], "ACTIVE" => "Y");
         $arSelectFields = array("ID", "NAME", "DESCRIPTION", "IBLOCK_ID");
         $res = CIBlockSection::GetList(array(), $arFilter, false, $arSelectFields);
         if ($arMeeting = $res->GetNext()) {
             return array('ID' => $Params['VMiblockId'], 'NAME' => $arMeeting["NAME"], 'DESCRIPTION' => $arMeeting['DESCRIPTION']);
         }
     }
     return false;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:20,代码来源:calendar.php

示例9: CheckAccess

 /**
  * <p>Метод проверяет доступ пользователя.</p>
  *
  *
  *
  *
  * @param string $access  Тип проверяемого доступа (view, write, delete)
  *
  *
  *
  * @return bool 
  *
  *
  * <h4>See Also</h4> 
  * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/wiki/classes/cwikiutils/IsReadable.php">CWikiUtils::isReadable</a>
  * </li> <li> <a
  * href="http://dev.1c-bitrix.ru/api_help/wiki/classes/cwikiutils/IsWriteable.php">CWikiUtils::isWriteable</a> </li> <li>
  * <a href="http://dev.1c-bitrix.ru/api_help/wiki/classes/cwikiutils/IsDeleteable.php">CWikiUtils::IsDeleteable</a> </li>
  * <li> <a href="http://dev.1c-bitrix.ru/api_help/wiki/classes/cwikiutils/IsAllowHTML.php">CWikiUtils::isAllowHTML</a>
  * </li> </ul><br><br>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/wiki/classes/cwikiutils/CheckAccess.php
  * @author Bitrix
  */
 static function CheckAccess($access = 'view')
 {
     global $APPLICATION, $USER, $arParams;
     if ($USER->IsAdmin()) {
         return true;
     }
     if (CWikiSocnet::IsSocNet()) {
         $arSonetGroup = CSocNetGroup::GetByID($iSocNetId);
         if ($arSonetGroup && CSocNetUser::IsCurrentUserModuleAdmin($arSonetGroup['SITE_ID'])) {
             return true;
         }
         if (!CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_GROUP, CWikiSocnet::$iSocNetId, 'wiki', $access)) {
             return false;
         }
         return true;
     } else {
         $letter = 'R';
         $letterI = 'R';
         switch ($access) {
             case 'write':
                 $letter = 'W';
                 $letterI = 'W';
                 break;
             case 'delete':
                 $letter = 'Y';
                 $letterI = 'W';
                 break;
             case 'perm':
                 $letter = 'Z';
                 $letterI = 'X';
                 break;
         }
         $wikiModulePermission = $APPLICATION->GetGroupRight('wiki');
         $iblockPermission = CIBlock::GetPermission($arParams['IBLOCK_ID']);
         return $wikiModulePermission >= $letter && $iblockPermission >= $letterI;
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:63,代码来源:wiki_utils.php

示例10: GetPermission

 function GetPermission($type, $id, $op = '', $runSymlinkProxy = true)
 {
     if ($this->e_rights) {
         if ($op === '') {
             return $this->GetPermissions($type, $id, $this->IBLOCK_ID);
         } else {
             if ($type == 'SECTION') {
                 if ($runSymlinkProxy) {
                     list($contextType, $contextEntityId) = $this->getContextData();
                     $sectionData = $this->getSectionDataForLinkAnalyze($id);
                     //if this element is link.
                     if ($sectionData && $sectionData['ID'] != $id) {
                         return self::GetPermission($type, $sectionData['ID'], $op);
                     }
                 }
             }
             $ibRights = $this->_get_ib_rights_object($type, $id);
             $result = $ibRights->UserHasRightTo($this->IBLOCK_ID, $id, trim($op));
             return $result;
         }
     } else {
         return CIBlock::GetPermission($this->IBLOCK_ID);
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:24,代码来源:iblock.php

示例11: GetPermission

 function GetPermission()
 {
     static $arResult = array();
     $user_id = intVal($GLOBALS["USER"]->GetID());
     $user_groups = $GLOBALS["USER"]->GetGroups();
     if (!$this->IBlockID) {
         return false;
     }
     $arCache = array("id" => serialize(array("iblock_id" => $this->IBlockID, "permission" => $user_groups, "site" => SITE_ID)), "path" => $this->arCache["path"], "time" => $this->arCache["time"]);
     if (empty($arResult[$arCache["id"]])) {
         $cache = new CPHPCache();
         if ($arCache["time"] > 0 && $cache->InitCache($arCache["time"], $arCache["id"], $arCache["path"])) {
             $arResult[$arCache["id"]] = $cache->GetVars();
         } else {
             CModule::IncludeModule("iblock");
             $arResult[$arCache["id"]] = CIBlock::GetPermission($this->IBlockID);
             if ($arCache["time"] > 0) {
                 $cache->StartDataCache($arCache["time"], $arCache["id"], $arCache["path"]);
                 $cache->EndDataCache($arResult[$arCache["id"]]);
             }
         }
     }
     if (!empty($arResult[$arCache["id"]])) {
         if (!empty($this->Gallery) && "R" <= $arResult[$arCache["id"]] && $arResult[$arCache["id"]] < "W" && $this->Gallery["CREATED_BY"] == $user_id) {
             return "W";
         }
         return $arResult[$arCache["id"]];
     }
     return "D";
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:30,代码来源:components_lib.php

示例12: Str_Replace

}
if ($taskType == "user") {
    $arParams["PATH_TO_TASKS"] = Str_Replace("#user_id#", "#owner_id#", $arParams["PATH_TO_USER_TASKS"]);
    $arParams["PATH_TO_TASKS_VIEW"] = Str_Replace("#user_id#", "#owner_id#", $arParams["PATH_TO_USER_TASKS_VIEW"]);
} else {
    $arParams["PATH_TO_TASKS"] = Str_Replace("#group_id#", "#owner_id#", $arParams["PATH_TO_GROUP_TASKS"]);
    $arParams["PATH_TO_TASKS_VIEW"] = Str_Replace("#group_id#", "#owner_id#", $arParams["PATH_TO_GROUP_TASKS_VIEW"]);
}
if (!$GLOBALS["USER"]->IsAuthorized()) {
    $arResult["NEED_AUTH"] = "Y";
} else {
    $arResult["FatalError"] = "";
    $arParams["TASK_TYPE"] = $taskType;
    $arParams["OWNER_ID"] = $ownerId;
    include $_SERVER['DOCUMENT_ROOT'] . "/bitrix/components/bitrix/intranet.tasks/init.php";
    $iblockPerm = CIBlock::GetPermission($iblockId);
    if ($iblockPerm < "R") {
        $arResult["FatalError"] .= GetMessage("INTV_NO_IBLOCK_PERMS") . ".";
    }
    if (StrLen($arResult["FatalError"]) <= 0) {
        if (!__InTaskCheckActiveFeature($taskType, $ownerId)) {
            $arResult["FatalError"] .= GetMessage("INTV_TASKS_OFF") . ".";
        }
    }
    if (StrLen($arResult["FatalError"]) <= 0) {
        $arResult["Perms"] = __InTaskInitPerms($taskType, $ownerId);
        if (!$arResult["Perms"]["view"]) {
            $arResult["FatalError"] .= GetMessage("INTV_NO_SONET_PERMS") . ".";
        }
    }
    if (StrLen($arResult["FatalError"]) <= 0) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例13: CheckAccess

 public static function CheckAccess($IBLOCK_ID)
 {
     $result = null;
     $events = GetModuleEvents("intranet", "OnSharepointCheckAccess");
     while ($arEvent = $events->Fetch()) {
         $res = ExecuteModuleEventEx($arEvent, array($IBLOCK_ID));
         if ($res === false) {
             return false;
         } elseif ($res === true) {
             $result = true;
         }
     }
     if (null === $result) {
         $result = CIBlock::GetPermission($IBLOCK_ID) >= 'W';
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:17,代码来源:sharepoint.php

示例14: _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

示例15: GetIBlockPermission

 public static function GetIBlockPermission($iblock_id, $user_id)
 {
     global $USER;
     //IBlock permissions by default
     $Permission = CIBlock::GetPermission($iblock_id, $user_id);
     if ($Permission < "W") {
         $arIBlock = CIBlock::GetArrayByID($iblock_id);
         if ($arIBlock) {
             //Check if iblock is list
             $arListsPerm = CLists::GetPermission($arIBlock["IBLOCK_TYPE_ID"]);
             if (count($arListsPerm)) {
                 //User groups
                 if ($user_id == $USER->GetID()) {
                     $arUserGroups = $USER->GetUserGroupArray();
                 } else {
                     $arUserGroups = $USER->GetUserGroup($user_id);
                 }
                 //One of lists admins
                 if (count(array_intersect($arListsPerm, $arUserGroups))) {
                     $Permission = "X";
                 }
             }
         }
     }
     if ($Permission < "W" && $arIBlock["SOCNET_GROUP_ID"] && CModule::IncludeModule('socialnetwork')) {
         $arSocnetPerm = CLists::GetSocnetPermission($iblock_id);
         $socnet_role = CSocNetUserToGroup::GetUserRole($USER->GetID(), $arIBlock["SOCNET_GROUP_ID"]);
         $Permission = $arSocnetPerm[$socnet_role];
     }
     return $Permission;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:31,代码来源:lists.php


注:本文中的CIBlock::GetPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。