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


PHP CCrmPerms::GetCurrentUserPermissions方法代码示例

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


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

示例1: getUserPermissions

 /**
  * @return \CCrmPerms
  */
 protected function getUserPermissions()
 {
     if ($this->userPermissions === null) {
         $this->userPermissions = \CCrmPerms::GetCurrentUserPermissions();
     }
     return $this->userPermissions;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:10,代码来源:entityconverter.php

示例2: GetUserPermissions

 public static function GetUserPermissions()
 {
     if (self::$USER_PERMISSIONS === null) {
         self::$USER_PERMISSIONS = CCrmPerms::GetCurrentUserPermissions();
     }
     return self::$USER_PERMISSIONS;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:7,代码来源:crm_authorization_helper.php

示例3: checkRights

 public function checkRights()
 {
     $permissions = CCrmPerms::GetCurrentUserPermissions();
     if (!(CCrmPerms::IsAccessEnabled($permissions) && $permissions->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ'))) {
         return false;
     }
     return true;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:8,代码来源:helper.php

示例4: ShowError

}
$arResult['ENTITY_ID'] = $entityID;
if ($entityTypeID <= CCrmOwnerType::Undefined) {
    ShowError(GetMessage('CRM_PRODUCT_LIST_OWNER_TYPE_NOT_DEFINED'));
    return;
}
if ($entityTypeID !== CCrmOwnerType::Deal && $entityTypeID !== CCrmOwnerType::Lead && $entityTypeID !== CCrmOwnerType::Invoice) {
    ShowError(GetMessage('CRM_PRODUCT_LIST_OWNER_TYPE_NOT_SUPPORTED'));
    return;
}
if ($entityID <= 0) {
    ShowError(GetMessage('CRM_PRODUCT_LIST_OWNER_ID_NOT_DEFINED'));
    return;
}
$entityTypeName = CCrmOwnerType::ResolveName($entityTypeID);
$userPerms = CCrmPerms::GetCurrentUserPermissions();
if (!CCrmAuthorizationHelper::CheckReadPermission($entityTypeName, $entityID, $userPerms)) {
    ShowError(GetMessage('CRM_PERMISSION_DENIED'));
    return;
}
$arParams['UID'] = isset($arParams['UID']) ? $arParams['UID'] : '';
if (!isset($arParams['UID']) || $arParams['UID'] === '') {
    $arParams['UID'] = 'mobile_crm_product_row_list';
}
$arResult['UID'] = $arParams['UID'];
$arResult['ITEMS'] = array();
$arResult['TAX_MODE'] = 'NONE';
if ($entityTypeID === CCrmOwnerType::Deal) {
    $dbRes = CCrmDeal::GetListEx(array(), array('ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('TITLE', 'CURRENCY_ID', 'OPPORTUNITY'));
    $arOwner = $dbRes ? $dbRes->Fetch() : null;
    if ($arOwner) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例5: __CrmMobileDealEditEndResonse

//$langID = isset($_REQUEST['lang_id'])? $_REQUEST['lang_id']: LANGUAGE_ID;
//__IncludeLang(dirname(__FILE__).'/lang/'.$langID.'/'.basename(__FILE__));
CUtil::JSPostUnescape();
if (!function_exists('__CrmMobileDealEditEndResonse')) {
    function __CrmMobileDealEditEndResonse($result)
    {
        $GLOBALS['APPLICATION']->RestartBuffer();
        Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
        if (!empty($result)) {
            echo CUtil::PhpToJSObject($result);
        }
        require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';
        die;
    }
}
$curUserPrems = CCrmPerms::GetCurrentUserPermissions();
$action = isset($_REQUEST['ACTION']) ? $_REQUEST['ACTION'] : '';
if ($action === 'SAVE_ENTITY') {
    __IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
    $typeName = isset($_REQUEST['ENTITY_TYPE_NAME']) ? $_REQUEST['ENTITY_TYPE_NAME'] : '';
    if ($typeName !== CCrmOwnerType::DealName) {
        __CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_TYPE_NOT_SUPPORTED', array('#ENTITY_TYPE#' => $typeName))));
    }
    $data = isset($_REQUEST['ENTITY_DATA']) && is_array($_REQUEST['ENTITY_DATA']) ? $_REQUEST['ENTITY_DATA'] : array();
    if (count($data) == 0) {
        __CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_DATA_NOT_FOUND')));
    }
    $ID = isset($data['ID']) ? intval($data['ID']) : 0;
    $isNew = $ID <= 0;
    $hasPermission = $isNew ? CCrmDeal::CheckCreatePermission() : CCrmDeal::CheckUpdatePermission($ID);
    if (!$hasPermission) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:ajax.php

示例6: ProcessLogEventEditPOST

 public static function ProcessLogEventEditPOST($arPOST, $entityTypeID, $entityID, &$arResult)
 {
     $arEntityData = array();
     $errors = array();
     $enableTitle = isset($arPOST['ENABLE_POST_TITLE']) && strtoupper($arPOST['ENABLE_POST_TITLE']) === 'Y';
     $title = $enableTitle && isset($arPOST['POST_TITLE']) ? $arPOST['POST_TITLE'] : '';
     $message = isset($arPOST['MESSAGE']) ? htmlspecialcharsback($arPOST['MESSAGE']) : '';
     $arResult['EVENT']['MESSAGE'] = $message;
     $arResult['EVENT']['TITLE'] = $title;
     $arResult['ENABLE_TITLE'] = $enableTitle;
     $attachedFiles = array();
     $webDavFileFieldName = $arResult['WEB_DAV_FILE_FIELD_NAME'];
     if ($webDavFileFieldName !== '' && isset($GLOBALS[$webDavFileFieldName]) && is_array($GLOBALS[$webDavFileFieldName])) {
         foreach ($GLOBALS[$webDavFileFieldName] as $fileID) {
             if ($fileID === '') {
                 continue;
             }
             //fileID:  "888|165|16"
             $attachedFiles[] = $fileID;
         }
         if (!empty($attachedFiles) && is_array($arResult['WEB_DAV_FILE_FIELD'])) {
             $arResult['WEB_DAV_FILE_FIELD']['VALUE'] = $attachedFiles;
         }
     }
     $allowToAll = COption::GetOptionString('socialnetwork', 'allow_livefeed_toall', 'Y') === 'Y';
     if ($allowToAll) {
         $arToAllRights = unserialize(COption::GetOptionString("socialnetwork", "livefeed_toall_rights", 'a:1:{i:0;s:2:"AU";}'));
         if (!$arToAllRights) {
             $arToAllRights = array('AU');
         }
         $arUserGroupCode = array_merge(array('AU'), CAccess::GetUserCodesArray($arResult['USER_ID']));
         if (count(array_intersect($arToAllRights, $arUserGroupCode)) <= 0) {
             $allowToAll = false;
         }
     }
     $arSocnetRights = array();
     if (!empty($arPOST['SPERM'])) {
         foreach ($arPOST['SPERM'] as $v => $k) {
             if (strlen($v) > 0 && is_array($k) && !empty($k)) {
                 foreach ($k as $vv) {
                     if (strlen($vv) > 0) {
                         $arSocnetRights[] = $vv;
                     }
                 }
             }
         }
     }
     if (in_array('UA', $arSocnetRights) && !$allowToAll) {
         foreach ($arSocnetRights as $key => $value) {
             if ($value == 'UA') {
                 unset($arSocnetRights[$key]);
                 break;
             }
         }
     }
     foreach ($arSocnetRights as $key => $value) {
         if ($value == 'UA') {
             $arSocnetRights[] = 'AU';
             unset($arSocnetRights[$key]);
             break;
         }
     }
     $arSocnetRights = array_unique($arSocnetRights);
     $allFeedEtityTypes = CCrmLiveFeedEntity::GetAll();
     $userPerms = CCrmPerms::GetCurrentUserPermissions();
     foreach ($arSocnetRights as $key => $value) {
         $groupCodeData = array();
         if (CCrmLiveFeed::TryParseGroupCode($value, $groupCodeData) && in_array($groupCodeData['ENTITY_TYPE'], $allFeedEtityTypes, true)) {
             $groupCodeEntityType = $groupCodeData['ENTITY_TYPE'];
             $groupCodeEntityID = $groupCodeData['ENTITY_ID'];
             if (!CCrmLiveFeed::CheckCreatePermission($groupCodeEntityType, $groupCodeEntityID, $userPerms)) {
                 $canonicalEntityTypeID = CCrmLiveFeedEntity::ResolveEntityTypeID($groupCodeEntityType);
                 $errors[] = GetMessage('CRM_SL_EVENT_EDIT_PERMISSION_DENIED', array('#TITLE#' => CCrmOwnerType::GetCaption($canonicalEntityTypeID, $groupCodeEntityID, false)));
             } else {
                 $arEntityData[] = array('ENTITY_TYPE' => $groupCodeEntityType, 'ENTITY_ID' => $groupCodeEntityID);
             }
         }
     }
     if (!(CCrmOwnerType::IsDefined($entityTypeID) && $entityID > 0) && !empty($arEntityData)) {
         $entityData = $arEntityData[0];
         $entityTypeID = CCrmLiveFeedEntity::ResolveEntityTypeID($entityData['ENTITY_TYPE']);
         $entityID = $entityData['ENTITY_ID'];
     }
     if (!empty($arEntityData)) {
         $arResult['ENTITY_DATA'] = $arEntityData;
     }
     if (!(CCrmOwnerType::IsDefined($entityTypeID) && $entityID > 0)) {
         $errors[] = GetMessage('CRM_SL_EVENT_EDIT_ENTITY_NOT_DEFINED');
     }
     if ($message === '') {
         $errors[] = GetMessage('CRM_SL_EVENT_EDIT_EMPTY_MESSAGE');
     }
     if (empty($errors)) {
         $fields = array('ENTITY_TYPE_ID' => $entityTypeID, 'ENTITY_ID' => $entityID, 'USER_ID' => $arResult['USER_ID'], 'TITLE' => $title, 'MESSAGE' => $message, 'RIGHTS' => $arSocnetRights);
         $parents = array();
         CCrmOwnerType::TryGetOwnerInfos($entityTypeID, $entityID, $parents, array('ENABLE_MAPPING' => true));
         foreach ($arEntityData as $entityData) {
             $curEntityTypeID = CCrmLiveFeedEntity::ResolveEntityTypeID($entityData['ENTITY_TYPE']);
             $curEntityID = $entityData['ENTITY_ID'];
             $entityKey = "{$curEntityTypeID}_{$curEntityID}";
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:livefeed.php

示例7: CheckReadPermission

 public static function CheckReadPermission($ID = 0)
 {
     $perms = CCrmPerms::GetCurrentUserPermissions();
     return $perms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ');
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:5,代码来源:crm_currency.php

示例8: PrepareConversionPermissionFlags

 public static function PrepareConversionPermissionFlags($ID, array &$params, $userPermissions = null)
 {
     if (!$userPermissions) {
         $userPermissions = CCrmPerms::GetCurrentUserPermissions();
     }
     $canCreateDeal = CCrmDeal::CheckCreatePermission($userPermissions);
     $canCreateInvoice = IsModuleInstalled('sale') && CCrmInvoice::CheckCreatePermission($userPermissions);
     $params['CAN_CONVERT_TO_DEAL'] = $canCreateDeal;
     $params['CAN_CONVERT_TO_INVOICE'] = $canCreateInvoice;
     $params['CAN_CONVERT'] = $params['CONVERT'] = $canCreateInvoice || $canCreateDeal;
     $restriction = \Bitrix\Crm\Restriction\RestrictionManager::getConversionRestriction();
     if ($restriction->hasPermission()) {
         $params['CONVERSION_PERMITTED'] = true;
     } else {
         $params['CONVERSION_PERMITTED'] = false;
         $params['CONVERSION_LOCK_SCRIPT'] = $restriction->preparePopupScript();
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:18,代码来源:crm_quote.php

示例9: __construct

 function __construct($bCheckPermission = true)
 {
     $this->bCheckPermission = $bCheckPermission;
     $this->cPerms = CCrmPerms::GetCurrentUserPermissions();
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:5,代码来源:crm_deal.php

示例10: IsAccessEnabled

 public static function IsAccessEnabled($userPerms = null)
 {
     if ($userPerms === null || !is_object($userPerms)) {
         $userPerms = CCrmPerms::GetCurrentUserPermissions();
     }
     return !$userPerms->HavePerm('LEAD', self::PERM_NONE) || !$userPerms->HavePerm('CONTACT', self::PERM_NONE) || !$userPerms->HavePerm('COMPANY', self::PERM_NONE) || !$userPerms->HavePerm('DEAL', self::PERM_NONE) || !$userPerms->HavePerm('QUOTE', self::PERM_NONE) || !$userPerms->HavePerm('INVOICE', self::PERM_NONE);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:7,代码来源:crm_perms.php

示例11: CheckPermission

 function CheckPermission($arUserField, $userID = false)
 {
     //permission check is disabled
     if ($userID === false) {
         return true;
     }
     if (!CModule::IncludeModule('crm')) {
         return false;
     }
     $userID = intval($userID);
     $userPerms = $userID > 0 ? CCrmPerms::GetUserPermissions($userID) : CCrmPerms::GetCurrentUserPermissions();
     return CCrmPerms::IsAccessEnabled($userPerms);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:13,代码来源:crm_usertypecrm.php

示例12: processMethodRequest

 public function processMethodRequest($name, $nameDetails, $arParams, $nav, $server)
 {
     $name = strtoupper($name);
     if ($name === 'ADD') {
         $fields = $this->resolveArrayParam($arParams, 'fields');
         $arComponentResult = array('USER_ID' => $this->getCurrentUserID());
         $arPOST = array('ENABLE_POST_TITLE' => 'Y', 'MESSAGE' => $fields['MESSAGE'], 'SPERM' => $fields['SPERM']);
         if (isset($fields['POST_TITLE']) && strlen($fields['POST_TITLE']) > 0) {
             $arPOST['POST_TITLE'] = $fields['POST_TITLE'];
         }
         $entityTypeID = $fields['ENTITYTYPEID'];
         $entityID = $fields['ENTITYID'];
         $entityTypeName = CCrmOwnerType::ResolveName($entityTypeID);
         $userPerms = CCrmPerms::GetCurrentUserPermissions();
         if ($entityTypeName !== '' && !CCrmAuthorizationHelper::CheckUpdatePermission($entityTypeName, $entityID, $userPerms)) {
             throw new RestException('Access denied.');
         }
         $res = CCrmLiveFeedComponent::ProcessLogEventEditPOST($arPOST, $entityTypeID, $entityID, $arComponentResult);
         if (is_array($res)) {
             throw new RestException(implode(", ", $res));
         }
         return $res;
     }
     throw new RestException('Method not found!', RestException::ERROR_METHOD_NOT_FOUND, CRestServer::STATUS_NOT_FOUND);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:25,代码来源:restservice.php

示例13: PrepareConversionPermissionFlags

 public static function PrepareConversionPermissionFlags($ID, array &$params, $userPermissions = null)
 {
     if (!$userPermissions) {
         $userPermissions = CCrmPerms::GetCurrentUserPermissions();
     }
     $canEdit = CCrmAuthorizationHelper::CheckUpdatePermission(self::$TYPE_NAME, $ID, $userPermissions);
     $canCreateContact = CCrmContact::CheckCreatePermission($userPermissions);
     $canCreateCompany = CCrmCompany::CheckCreatePermission($userPermissions);
     $canCreateDeal = CCrmDeal::CheckCreatePermission($userPermissions);
     $params['CAN_CONVERT_TO_CONTACT'] = $canEdit && $canCreateContact;
     $params['CAN_CONVERT_TO_COMPANY'] = $canEdit && $canCreateCompany;
     $params['CAN_CONVERT_TO_DEAL'] = $canEdit && $canCreateDeal;
     $params['CAN_CONVERT'] = $params['CONVERT'] = $canEdit && ($canCreateContact || $canCreateCompany || $canCreateDeal);
     $params['CONVERSION_PERMITTED'] = true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:15,代码来源:crm_lead.php

示例14: WriteDiskFileToResponse

 public static function WriteDiskFileToResponse($ownerTypeID, $ownerID, $fileID, &$errors, $options = array())
 {
     $ownerTypeID = (int) $ownerTypeID;
     $ownerTypeName = CCrmOwnerType::ResolveName($ownerTypeID);
     $ownerID = (int) $ownerID;
     $fileID = (int) $fileID;
     $options = is_array($options) ? $options : array();
     if (!CCrmOwnerType::IsDefined($ownerTypeID) || $ownerID <= 0 || $fileID <= 0) {
         $errors[] = 'Invalid data ownerTypeID = ' . $ownerTypeID . ', ownerID = ' . $ownerID . ', fileID = ' . $fileID;
         return false;
     }
     if ($ownerTypeID !== CCrmOwnerType::Activity) {
         $errors[] = "The owner type '{$ownerTypeName}' is not supported in current context";
         return false;
     }
     $authToken = isset($options['oauth_token']) ? $options['oauth_token'] : '';
     if ($authToken !== '') {
         $authData = array();
         if (!(CModule::IncludeModule('rest') && CRestUtil::checkAuth($authToken, CCrmRestService::SCOPE_NAME, $authData) && CRestUtil::makeAuth($authData))) {
             $errors[] = 'Access denied.';
             return false;
         }
     }
     if (!CCrmActivity::CheckStorageElementExists($ownerID, CCrmActivityStorageType::Disk, $fileID)) {
         $errors[] = 'File not found';
         return false;
     }
     $isPermitted = false;
     if (CCrmPerms::IsAdmin()) {
         $isPermitted = true;
     } else {
         $userPermissions = CCrmPerms::GetCurrentUserPermissions();
         $bindings = CCrmActivity::GetBindings($ownerID);
         foreach ($bindings as $binding) {
             if (CCrmAuthorizationHelper::CheckReadPermission($binding['OWNER_TYPE_ID'], $binding['OWNER_ID'], $userPermissions)) {
                 $isPermitted = true;
                 break;
             }
         }
     }
     if (!$isPermitted) {
         $errors[] = 'Access denied.';
         return false;
     }
     Bitrix\Crm\Integration\DiskManager::writeFileToResponse($fileID);
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:47,代码来源:file_proxy.php

示例15: WriteFileToResponse

 public static function WriteFileToResponse($ownerTypeID, $ownerID, $fieldName, $fileID, &$errors, $options = array())
 {
     $ownerTypeID = intval($ownerTypeID);
     $ownerTypeName = CCrmOwnerType::ResolveName($ownerTypeID);
     $ownerID = intval($ownerID);
     $fieldName = strval($fieldName);
     $fileID = intval($fileID);
     $options = is_array($options) ? $options : array();
     if (!CCrmOwnerType::IsDefined($ownerTypeID) || $ownerID <= 0 || $fieldName === '' || $fileID <= 0) {
         $errors[] = 'File not found';
         return false;
     }
     $authToken = isset($options['oauth_token']) ? strval($options['oauth_token']) : '';
     if ($authToken !== '') {
         $authData = array();
         if (!(CModule::IncludeModule('rest') && CRestUtil::checkAuth($authToken, CCrmRestService::SCOPE_NAME, $authData) && CRestUtil::makeAuth($authData))) {
             $errors[] = 'Access denied.';
             return false;
         }
     }
     if (!CCrmPerms::IsAdmin()) {
         $userPermissions = CCrmPerms::GetCurrentUserPermissions();
         $attrs = $userPermissions->GetEntityAttr($ownerTypeName, $ownerID);
         if ($userPermissions->HavePerm($ownerTypeName, BX_CRM_PERM_NONE, 'READ') || !$userPermissions->CheckEnityAccess($ownerTypeName, 'READ', isset($attrs[$ownerID]) ? $attrs[$ownerID] : array())) {
             $errors[] = 'Access denied.';
             return false;
         }
     }
     $isDynamic = isset($options['is_dynamic']) ? (bool) $options['is_dynamic'] : true;
     if ($isDynamic) {
         $userFields = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields(CCrmOwnerType::ResolveUserFieldEntityID($ownerTypeID), $ownerID, LANGUAGE_ID);
         $field = is_array($userFields) && isset($userFields[$fieldName]) ? $userFields[$fieldName] : null;
         if (!(is_array($field) && $field['USER_TYPE_ID'] === 'file')) {
             $errors[] = 'File not found';
             return false;
         }
         $fileIDs = isset($field['VALUE']) ? is_array($field['VALUE']) ? $field['VALUE'] : array($field['VALUE']) : array();
         //The 'strict' flag must be 'false'. In MULTIPLE mode value is an array of integers. In SIGLE mode value is a string.
         if (!in_array($fileID, $fileIDs, false)) {
             $errors[] = 'File not found';
             return false;
         }
         return self::InnerWriteFileToResponse($fileID, $errors, $options);
     } else {
         $fieldsInfo = isset($options['fields_info']) ? $options['fields_info'] : null;
         if (!is_array($fieldsInfo)) {
             $fieldsInfo = CCrmOwnerType::GetFieldsInfo($ownerTypeID);
         }
         $fieldInfo = is_array($fieldsInfo) && isset($fieldsInfo[$fieldName]) ? $fieldsInfo[$fieldName] : array();
         $fieldInfoType = isset($fieldInfo['TYPE']) ? $fieldInfo['TYPE'] : '';
         if ($fieldInfoType !== 'file') {
             $errors[] = 'File not found';
             return false;
         }
         if ($fileID !== CCrmOwnerType::GetFieldIntValue($ownerTypeID, $ownerID, $fieldName)) {
             $errors[] = 'File not found';
             return false;
         }
         return self::InnerWriteFileToResponse($fileID, $errors, $options);
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:61,代码来源:file_proxy.php


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