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


PHP Users_Privileges_Model::getParentRecord方法代码示例

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


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

示例1: isPermitted


//.........这里部分代码省略.........
        }
        //Retreiving the default Organisation sharing Access
        $others_permission_id = $defaultOrgSharingPermission[$tabid];
        if (in_array($current_user->id, $shownerids) || count(array_intersect($shownerids, $current_user_groups)) > 0) {
            $permission = 'yes';
            $log->debug('Exiting isPermitted method ... - Shared Owner');
            return $permission;
        }
        if ($recOwnType == 'Users') {
            //Checking if the Record Owner is the current User
            if ($current_user->id == $recOwnId) {
                $permission = 'yes';
                $log->debug('Exiting isPermitted method ...');
                return $permission;
            }
            //Checking if the Record Owner is the Subordinate User
            foreach ($subordinate_roles_users as $roleid => $userids) {
                if (in_array($recOwnId, $userids)) {
                    $permission = 'yes';
                    $log->debug('Exiting isPermitted method ...');
                    return $permission;
                }
            }
        } elseif ($recOwnType == 'Groups') {
            //Checking if the record owner is the current user's group
            if (in_array($recOwnId, $current_user_groups)) {
                $permission = 'yes';
                $log->debug("Exiting isPermitted method ...");
                return $permission;
            }
        }
        $role = getRoleInformation($current_user->roleid);
        if (($actionid == 3 || $actionid == 4) && $role['previewrelatedrecord'] != 0 || ($actionid == 0 || $actionid == 1) && $role['editrelatedrecord'] != 0) {
            $parentRecord = Users_Privileges_Model::getParentRecord($record_id, $module, $role['previewrelatedrecord']);
            if ($parentRecord) {
                $recordMetaData = Vtiger_Functions::getCRMRecordMetadata($parentRecord);
                if ($role['permissionsrelatedfield'] == 0) {
                    $relatedPermission = $current_user->id == $recordMetaData['smownerid'];
                } else {
                    if ($role['permissionsrelatedfield'] == 1) {
                        $relatedPermission = in_array($current_user->id, Vtiger_SharedOwner_UIType::getSharedOwners($parentRecord, $recordMetaData['setype']));
                    } else {
                        if ($role['permissionsrelatedfield'] == 2) {
                            $relatedPermission = $current_user->id == $recordMetaData['smownerid'] || in_array($current_user->id, Vtiger_SharedOwner_UIType::getSharedOwners($parentRecord, $recordMetaData['setype']));
                        }
                    }
                }
                if ($relatedPermission) {
                    $permission = 'yes';
                    $log->debug('Exiting isPermitted method ... - Parent Record Owner');
                    return $permission;
                }
            }
        }
        //Checking for Default Org Sharing permission
        if ($others_permission_id == 0) {
            if ($actionid == 1 || $actionid == 0) {
                $permission = isReadWritePermittedBySharing($module, $tabid, $actionid, $record_id);
                $log->debug("Exiting isPermitted method ...");
                return $permission;
            } elseif ($actionid == 2) {
                $permission = 'no';
                $log->debug("Exiting isPermitted method ...");
                return $permission;
            } else {
                $permission = 'yes';
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:67,代码来源:UserInfoUtil.php

示例2: getUserAccessConditionsQuerySR

 function getUserAccessConditionsQuerySR($module, $current_user = false, $relatedRecord = false)
 {
     if ($current_user == false) {
         $current_user = vglobal('current_user');
     }
     require 'user_privileges/user_privileges_' . $current_user->id . '.php';
     require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
     global $shared_owners;
     $is_admin = is_admin($current_user);
     $sharedParameter = $securityParameter = '';
     $query = '';
     $tabId = getTabid($module);
     if ($relatedRecord) {
         $role = getRoleInformation($current_user->roleid);
         if ($role['listrelatedrecord'] != 0) {
             $rparentRecord = Users_Privileges_Model::getParentRecord($relatedRecord, false, $role['listrelatedrecord']);
             if ($rparentRecord) {
                 $relatedRecord = $rparentRecord;
             }
             $recordMetaData = Vtiger_Functions::getCRMRecordMetadata($relatedRecord);
             $recordPermission = Users_Privileges_Model::isPermitted($recordMetaData['setype'], 'DetailView', $relatedRecord);
             if (!$recordPermission) {
                 throw new AppException('LBL_PERMISSION_DENIED');
             }
             if ($recordMetaData['smownerid'] == $current_user->id) {
                 return '';
             }
         }
     }
     if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tabId] == 3) {
         $securityParameter = $this->getUserAccessConditionsQuery($module, $current_user);
         $shownerid = array_merge([$current_user->id], $current_user_groups);
         $sharedParameter .= 'vtiger_crmentity.crmid IN (SELECT DISTINCT crmid FROM u_yf_crmentity_showners WHERE userid IN (' . implode(',', $shownerid) . '))';
     }
     if ($shared_owners == true) {
         if ($securityParameter != '') {
             $query .= " AND ( ({$securityParameter}) OR ({$sharedParameter}) )";
         } elseif ($sharedParameter != '') {
             $query .= ' AND (' . $sharedParameter . ')';
         }
     } else {
         $query .= $securityParameter;
     }
     return $query;
 }
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:45,代码来源:CRMEntity.php


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