本文整理汇总了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';
示例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;
}