本文整理汇总了PHP中GetUserGroups类的典型用法代码示例。如果您正苦于以下问题:PHP GetUserGroups类的具体用法?PHP GetUserGroups怎么用?PHP GetUserGroups使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GetUserGroups类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Reports
function Reports($reportId = "")
{
$db = PearDatabase::getInstance();
$currentUser = Users_Record_Model::getCurrentUserModel();
$userId = $currentUser->getId();
$this->initListOfModules();
if ($reportId != "") {
// Lookup information in cache first
$cachedInfo = VTCacheUtils::lookupReport_Info($userId, $reportId);
$subOrdinateUsers = VTCacheUtils::lookupReport_SubordinateUsers($reportId);
if ($cachedInfo === false) {
$ssql = "SELECT vtiger_reportmodules.*, vtiger_report.* FROM vtiger_report\n\t\t\t\t\t\t\tINNER JOIN vtiger_reportmodules ON vtiger_report.reportid = vtiger_reportmodules.reportmodulesid\n\t\t\t\t\t\t\tWHERE vtiger_report.reportid = ?";
$params = array($reportId);
require_once 'include/utils/GetUserGroups.php';
require 'user_privileges/user_privileges_' . $userId . '.php';
$userGroups = new GetUserGroups();
$userGroups->getAllUserGroups($userId);
$userGroupsList = $userGroups->user_groups;
if (!empty($userGroupsList) && $currentUser->isAdminUser() == false) {
$userGroupsQuery = " (shareid IN (" . generateQuestionMarks($userGroupsList) . ") AND setype='groups') OR";
array_push($params, $userGroupsList);
}
$nonAdminQuery = " vtiger_report.reportid IN (SELECT reportid from vtiger_reportsharing\n\t\t\t\t\t\t\t\t\tWHERE {$userGroupsQuery} (shareid=? AND setype='users'))";
if ($currentUser->isAdminUser() == false) {
$ssql .= " AND (({$nonAdminQuery})\n\t\t\t\t\t\t\t\tOR vtiger_report.sharingtype = 'Public'\n\t\t\t\t\t\t\t\tOR vtiger_report.owner = ? OR vtiger_report.owner IN\n\t\t\t\t\t\t\t\t\t(SELECT vtiger_user2role.userid FROM vtiger_user2role\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_users ON vtiger_users.id = vtiger_user2role.userid\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_role ON vtiger_role.roleid = vtiger_user2role.roleid\n\t\t\t\t\t\t\t\t\tWHERE vtiger_role.parentrole LIKE '{$current_user_parent_role_seq}::%')\n\t\t\t\t\t\t\t\t)";
array_push($params, $userId, $userId);
}
$result = $db->pquery($ssql, $params);
if ($result && $db->num_rows($result)) {
$reportModulesRow = $db->fetch_array($result);
// Update information in cache now
VTCacheUtils::updateReport_Info($userId, $reportId, $reportModulesRow["primarymodule"], $reportModulesRow["secondarymodules"], $reportModulesRow["reporttype"], $reportModulesRow["reportname"], $reportModulesRow["description"], $reportModulesRow["folderid"], $reportModulesRow["owner"]);
}
$subOrdinateUsers = array();
$subResult = $db->pquery("SELECT userid FROM vtiger_user2role\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_users ON vtiger_users.id = vtiger_user2role.userid\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_role ON vtiger_role.roleid = vtiger_user2role.roleid\n\t\t\t\t\t\t\t\t\tWHERE vtiger_role.parentrole LIKE '{$current_user_parent_role_seq}::%'", array());
$numOfSubRows = $db->num_rows($subResult);
for ($i = 0; $i < $numOfSubRows; $i++) {
$subOrdinateUsers[] = $db->query_result($subResult, $i, 'userid');
}
// Update subordinate user information for re-use
VTCacheUtils::updateReport_SubordinateUsers($reportId, $subOrdinateUsers);
// Re-look at cache to maintain code-consistency below
$cachedInfo = VTCacheUtils::lookupReport_Info($userId, $reportId);
}
if ($cachedInfo) {
$this->primodule = $cachedInfo["primarymodule"];
$this->secmodule = $cachedInfo["secondarymodules"];
$this->reporttype = $cachedInfo["reporttype"];
$this->reportname = decode_html($cachedInfo["reportname"]);
$this->reportdescription = decode_html($cachedInfo["description"]);
$this->folderid = $cachedInfo["folderid"];
if ($currentUser->isAdminUser() == true || in_array($cachedInfo["owner"], $subOrdinateUsers) || $cachedInfo["owner"] == $userId) {
$this->is_editable = true;
} else {
$this->is_editable = false;
}
}
}
return $this;
}
示例2: getGroupsIdsForUsers
public function getGroupsIdsForUsers($userId)
{
vimport('~include/utils/GetUserGroups.php');
$userGroupInstance = new GetUserGroups();
$userGroupInstance->getAllUserGroups($userId);
return $userGroupInstance->user_groups;
}
示例3: fetchUserGroupids
/** Function to get the lists of groupids releated with an user
* This function accepts the user id as arguments and
* returns the groupids related with the user id
* as a comma seperated string
*/
function fetchUserGroupids($userid)
{
global $log, $adb;
$log->debug("Entering fetchUserGroupids(" . $userid . ") method ...");
$focus = new GetUserGroups();
$focus->getAllUserGroups($userid);
//Asha: Remove implode if not required and if so, also remove explode functions used at the recieving end of this function
$groupidlists = implode(",", $focus->user_groups);
$log->debug("Exiting fetchUserGroupids method ...");
return $groupidlists;
}
示例4: vtws_getUsersInTheSameGroup
function vtws_getUsersInTheSameGroup($id)
{
require_once 'include/utils/GetGroupUsers.php';
require_once 'include/utils/GetUserGroups.php';
$groupUsers = new GetGroupUsers();
$userGroups = new GetUserGroups();
$allUsers = array();
$userGroups->getAllUserGroups($id);
$groups = $userGroups->user_groups;
foreach ($groups as $group) {
$groupUsers->getAllUsersInGroup($group);
$usersInGroup = $groupUsers->group_users;
foreach ($usersInGroup as $user) {
if ($user != $id) {
$allUsers[$user] = getUserFullName($user);
}
}
}
return $allUsers;
}
示例5: getVariable
public static function getVariable($var, $default, $module = '', $gvuserid = '')
{
global $adb, $current_user, $gvvalidationinfo, $currentModule;
$gvvalidationinfo[] = "search for variable '{$var}' with default value of '{$default}'";
if (empty($module)) {
$module = $currentModule;
}
if (empty($gvuserid)) {
$gvuserid = $current_user->id;
}
$key = md5('gvcache' . $var . $module . $gvuserid);
list($value, $found) = VTCacheUtils::lookupCachedInformation($key);
if ($found) {
$gvvalidationinfo[] = "variable found in cache";
return $value;
}
$value = '';
$list_of_modules = array();
$focus = CRMEntity::getInstance('GlobalVariable');
$select = 'SELECT *
FROM vtiger_globalvariable
INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_globalvariable.globalvariableid ';
$where = ' where vtiger_crmentity.deleted=0 and gvname=? ';
$mandatory = " and mandatory='1'";
$sql = $select . $where . $mandatory;
$gvvalidationinfo[] = '---';
$value = $focus->return_global_var_value($sql, $var, $module);
$gvvalidationinfo[] = "search as mandatory in module {$module}: {$value}";
if ($value != '') {
VTCacheUtils::updateCachedInformation($key, $value);
return $value;
}
if (!is_numeric($gvuserid) and $gvuserid > 0) {
return $default;
}
$user = $adb->convert2Sql(' and vtiger_crmentity.smownerid=?', array($gvuserid));
$sql = $select . $where . $user;
$gvvalidationinfo[] = '---';
$value = $focus->return_global_var_value($sql, $var, $module);
$gvvalidationinfo[] = "search as set per user {$gvuserid} in module {$module}: {$value}";
if ($value != '') {
VTCacheUtils::updateCachedInformation($key, $value);
return $value;
}
$gvvalidationinfo[] = '---';
require_once 'include/utils/GetUserGroups.php';
$UserGroups = new GetUserGroups();
$UserGroups->getAllUserGroups($gvuserid);
if (count($UserGroups->user_groups) > 0) {
$groups = implode(',', $UserGroups->user_groups);
$group = ' and vtiger_crmentity.smownerid in (' . $groups . ') ';
$sql = $select . $where . $group;
$value = $focus->return_global_var_value($sql, $var, $module);
$gvvalidationinfo[] = "search as set per group {$groups} in module {$module}: {$value}";
if ($value != '') {
VTCacheUtils::updateCachedInformation($key, $value);
return $value;
}
} else {
$gvvalidationinfo[] = 'no groups to search in';
}
$sql = $select . $where . " and default_check='1'";
$gvvalidationinfo[] = '---';
$value = $focus->return_global_var_value($sql, $var, $module);
$gvvalidationinfo[] = "search as default variable in module {$module}: {$value}";
if ($value != '') {
VTCacheUtils::updateCachedInformation($key, $value);
return $value;
}
$gvvalidationinfo[] = '---';
$gvvalidationinfo[] = "return default value give: {$default}";
return $default;
}
示例6: createUserPrivilegesfile
/** Creates a file with all the user, user-role,user-profile, user-groups informations
* @param $userid -- user id:: Type integer
* @returns user_privileges_userid file under the user_privileges directory
*/
function createUserPrivilegesfile($userid)
{
global $root_directory;
$handle = @fopen($root_directory . 'user_privileges/user_privileges_' . $userid . '.php', "w+");
if ($handle) {
$newbuf = '';
$newbuf .= "<?php\n\n";
$newbuf .= "\n";
$newbuf .= "//This is the access privilege file\n";
$user_focus = new Users();
$user_focus->retrieve_entity_info($userid, "Users");
$userInfo = array();
$user_focus->column_fields["id"] = '';
$user_focus->id = $userid;
foreach ($user_focus->column_fields as $field => $value_iter) {
$userInfo[$field] = $user_focus->{$field};
}
if ($user_focus->is_admin == 'on') {
$newbuf .= "\$is_admin=true;\n";
$newbuf .= "\n";
$newbuf .= "\$user_info=" . constructSingleStringKeyValueArray($userInfo) . ";\n";
$newbuf .= "\n";
$newbuf .= "?>";
fputs($handle, $newbuf);
fclose($handle);
return;
} else {
$newbuf .= "\$is_admin=false;\n";
$newbuf .= "\n";
$globalPermissionArr = getCombinedUserGlobalPermissions($userid);
$tabsPermissionArr = getCombinedUserTabsPermissions($userid);
//$tabsPermissionArr=getCombinedUserTabsPermissions($userid);
$actionPermissionArr = getCombinedUserActionPermissions($userid);
$user_role = fetchUserRole($userid);
$user_role_info = getRoleInformation($user_role);
$user_role_parent = $user_role_info[$user_role][1];
$userGroupFocus = new GetUserGroups();
$userGroupFocus->getAllUserGroups($userid);
$subRoles = getRoleSubordinates($user_role);
$subRoleAndUsers = getSubordinateRoleAndUsers($user_role);
$def_org_share = getDefaultSharingAction();
$parentRoles = getParentRole($user_role);
$newbuf .= "\$current_user_roles='" . $user_role . "';\n";
$newbuf .= "\n";
$newbuf .= "\$current_user_parent_role_seq='" . $user_role_parent . "';\n";
$newbuf .= "\n";
$newbuf .= "\$current_user_profiles=" . constructSingleArray(getUserProfile($userid)) . ";\n";
$newbuf .= "\n";
$newbuf .= "\$profileGlobalPermission=" . constructArray($globalPermissionArr) . ";\n";
$newbuf .= "\n";
$newbuf .= "\$profileTabsPermission=" . constructArray($tabsPermissionArr) . ";\n";
$newbuf .= "\n";
$newbuf .= "\$profileActionPermission=" . constructTwoDimensionalArray($actionPermissionArr) . ";\n";
$newbuf .= "\n";
$newbuf .= "\$current_user_groups=" . constructSingleArray($userGroupFocus->user_groups) . ";\n";
$newbuf .= "\n";
$newbuf .= "\$subordinate_roles=" . constructSingleCharArray($subRoles) . ";\n";
$newbuf .= "\n";
$newbuf .= "\$parent_roles=" . constructSingleCharArray($parentRoles) . ";\n";
$newbuf .= "\n";
$newbuf .= "\$subordinate_roles_users=" . constructTwoDimensionalCharIntSingleArray($subRoleAndUsers) . ";\n";
$newbuf .= "\n";
$newbuf .= "\$user_info=" . constructSingleStringKeyValueArray($userInfo) . ";\n";
$newbuf .= "?>";
fputs($handle, $newbuf);
fclose($handle);
}
}
}
示例7: sgetRptsforFldr
/** Function to get the Reports inside each modules
* This function accepts the folderid
* This Generates the Reports under each Reports module
* This Returns a HTML sring
*/
function sgetRptsforFldr($rpt_fldr_id, $paramsList = false)
{
$srptdetails = "";
global $adb;
global $log;
global $mod_strings, $current_user;
$returndata = array();
require_once 'include/utils/UserInfoUtil.php';
$sql = "select vtiger_report.*, vtiger_reportmodules.*, vtiger_reportfolder.folderid from vtiger_report inner join vtiger_reportfolder on vtiger_reportfolder.folderid = vtiger_report.folderid";
$sql .= " inner join vtiger_reportmodules on vtiger_reportmodules.reportmodulesid = vtiger_report.reportid";
$params = array();
// If information is required only for specific report folder?
if ($rpt_fldr_id !== false) {
$sql .= " where vtiger_reportfolder.folderid=?";
$params[] = $rpt_fldr_id;
}
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
require_once 'include/utils/GetUserGroups.php';
$userGroups = new GetUserGroups();
$userGroups->getAllUserGroups($current_user->id);
$user_groups = $userGroups->user_groups;
if (!empty($user_groups) && $is_admin == false) {
$user_group_query = " (shareid IN (" . generateQuestionMarks($user_groups) . ") AND setype='groups') OR";
array_push($params, $user_groups);
}
$non_admin_query = " vtiger_report.reportid IN (SELECT reportid from vtiger_reportsharing WHERE {$user_group_query} (shareid=? AND setype='users'))";
if ($is_admin == false) {
$sql .= " and ( (" . $non_admin_query . ") or vtiger_report.sharingtype='Public' or vtiger_report.owner = ? or vtiger_report.owner in(select vtiger_user2role.userid from vtiger_user2role inner join vtiger_users on vtiger_users.id=vtiger_user2role.userid inner join vtiger_role on vtiger_role.roleid=vtiger_user2role.roleid where vtiger_role.parentrole like '" . $current_user_parent_role_seq . "::%'))";
array_push($params, $current_user->id);
array_push($params, $current_user->id);
}
if ($paramsList) {
$startIndex = $paramsList['startIndex'];
$pageLimit = $paramsList['pageLimit'];
$orderBy = $paramsList['orderBy'];
$sortBy = $paramsList['sortBy'];
if ($orderBy) {
$sql .= " ORDER BY {$orderBy} {$sortBy}";
}
$sql .= " LIMIT {$startIndex}," . ($pageLimit + 1);
}
$query = $adb->pquery("select userid from vtiger_user2role inner join vtiger_users on vtiger_users.id=vtiger_user2role.userid inner join vtiger_role on vtiger_role.roleid=vtiger_user2role.roleid where vtiger_role.parentrole like '" . $current_user_parent_role_seq . "::%'", array());
$subordinate_users = array();
for ($i = 0; $i < $adb->num_rows($query); $i++) {
$subordinate_users[] = $adb->query_result($query, $i, 'userid');
}
$result = $adb->pquery($sql, $params);
$report = $adb->fetch_array($result);
if (count($report) > 0) {
do {
$report_details = array();
$report_details['customizable'] = $report["customizable"];
$report_details['reportid'] = $report["reportid"];
$report_details['primarymodule'] = $report["primarymodule"];
$report_details['secondarymodules'] = $report["secondarymodules"];
$report_details['state'] = $report["state"];
$report_details['description'] = $report["description"];
$report_details['reportname'] = $report["reportname"];
$report_details['reporttype'] = $report["reporttype"];
$report_details['sharingtype'] = $report["sharingtype"];
if ($is_admin == true || in_array($report["owner"], $subordinate_users) || $report["owner"] == $current_user->id) {
$report_details['editable'] = 'true';
} else {
$report_details['editable'] = 'false';
}
if (isPermitted($report["primarymodule"], 'index') == "yes") {
$returndata[$report["folderid"]][] = $report_details;
}
} while ($report = $adb->fetch_array($result));
}
if ($rpt_fldr_id !== false) {
$returndata = $returndata[$rpt_fldr_id];
}
$log->info("Reports :: ListView->Successfully returned vtiger_report details HTML");
return $returndata;
}
示例8: getParenttab
if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
}
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
//the user might belong to multiple groups
$log->info("User detail view");
$category = getParenttab();
$smarty = new vtigerCRM_Smarty();
$smarty->assign("UMOD", $mod_strings);
global $current_language;
$smod_strings = return_module_language($current_language, 'Settings');
$smarty->assign("MOD", $smod_strings);
$smarty->assign("APP", $app_strings);
$oGetUserGroups = new GetUserGroups();
$oGetUserGroups->getAllUserGroups($focus->id);
if (useInternalMailer() == 1) {
$smarty->assign("INT_MAILER", "true");
}
$smarty->assign("GROUP_COUNT", count($oGetUserGroups->user_groups));
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("PRINT_URL", "phprint.php?jt=" . session_id() . $GLOBALS['request_string']);
$smarty->assign("ID", $focus->id);
$smarty->assign("CATEGORY", $category);
if (isset($focus->imagename) && $focus->imagename != '') {
$imagestring = "<div id='track1' style='margin: 4px 0pt 0pt 10px; width: 200px; background-image: url(themes/images/scaler_slider_track.gif); background-repeat: repeat-x; background-position: left center; height: 18px;'>\n\t<div class='selected' id='handle1' style='width: 18px; height: 18px; position: relative; left: 145px;cursor:pointer;'><img src='" . vtiger_imageurl('scaler_slider.gif', $theme) . "'></div>\n\t</div>\n<script language='JavaScript' type='text/javascript' src='include/js/slider.js'></script>\n\n\t<div class='scale-image' style='padding: 10px; float: left; width: 83.415px;'><img src='test/user/" . $focus->imagename . "' width='100%'</div>\n\t<p><script type='text/javascript' src='include/js/scale_demo.js'></script></p>";
//$smarty->assign("USER_IMAGE",$imagestring);
}
if (isset($_REQUEST['modechk']) && $_REQUEST['modechk'] != '') {
示例9: checkUserPermissions
public function checkUserPermissions()
{
$permissions = $this->get('template_members');
if (empty($permissions)) {
return true;
}
$currentUser = Users_Record_Model::getCurrentUserModel();
$permissions = explode(',', $permissions);
if (in_array('Users:' . $currentUser->getId(), $permissions)) {
// check user id
return true;
} else {
$userGroups = new GetUserGroups();
$userGroups->getAllUserGroups($currentUser->getId());
foreach ($userGroups->user_groups as $group) {
if (in_array('Groups:' . $group, $permissions)) {
return true;
}
}
}
return false;
}
示例10: put
public function put($recordDetails, $user)
{
$log = vglobal('log');
$this->user = $user;
$recordDetails = $this->syncToNativeFormat($recordDetails);
$createdRecords = $recordDetails['created'];
$updatedRecords = $recordDetails['updated'];
$deletedRecords = $recordDetails['deleted'];
if (count($createdRecords) > 0) {
$createdRecords = $this->translateReferenceFieldNamesToIds($createdRecords, $user);
$createdRecords = $this->fillNonExistingMandatoryPicklistValues($createdRecords);
$createdRecords = $this->fillMandatoryFields($createdRecords, $user);
}
foreach ($createdRecords as $index => $record) {
$createdRecords[$index] = vtws_create($record['module'], $record, $this->user);
}
if (count($updatedRecords) > 0) {
$updatedRecords = $this->translateReferenceFieldNamesToIds($updatedRecords, $user);
}
$crmIds = array();
foreach ($updatedRecords as $index => $record) {
$webserviceRecordId = $record["id"];
$recordIdComp = vtws_getIdComponents($webserviceRecordId);
$crmIds[] = $recordIdComp[1];
}
$assignedRecordIds = array();
if ($this->isClientUserSyncType()) {
$assignedRecordIds = wsapp_checkIfRecordsAssignToUser($crmIds, $this->user->id);
// To check if the record assigned to group
if ($this->isClientUserAndGroupSyncType()) {
$getUserGroups = new GetUserGroups();
$getUserGroups->getAllUserGroups($this->user->id);
$groupIds = $getUserGroups->user_groups;
if (!empty($groupIds)) {
$groupRecordId = wsapp_checkIfRecordsAssignToUser($crmIds, $groupIds);
$assignedRecordIds = array_merge($assignedRecordIds, $groupRecordId);
}
}
// End
}
foreach ($updatedRecords as $index => $record) {
$webserviceRecordId = $record["id"];
$recordIdComp = vtws_getIdComponents($webserviceRecordId);
try {
if (in_array($recordIdComp[1], $assignedRecordIds)) {
$updatedRecords[$index] = vtws_revise($record, $this->user);
} else {
if (!$this->isClientUserSyncType()) {
$updatedRecords[$index] = vtws_revise($record, $this->user);
} else {
$this->assignToChangedRecords[$index] = $record;
}
}
} catch (Exception $e) {
continue;
}
// Added to handle duplication
if ($record['duplicate']) {
$updatedRecords[$index]['duplicate'] = true;
}
// End
}
$hasDeleteAccess = null;
$deletedCrmIds = array();
foreach ($deletedRecords as $index => $record) {
$webserviceRecordId = $record;
$recordIdComp = vtws_getIdComponents($webserviceRecordId);
$deletedCrmIds[] = $recordIdComp[1];
}
$assignedDeletedRecordIds = wsapp_checkIfRecordsAssignToUser($deletedCrmIds, $this->user->id);
// To get record id's assigned to group of the current user
if ($this->isClientUserAndGroupSyncType()) {
if (!empty($groupIds)) {
foreach ($groupIds as $group) {
$groupRecordId = wsapp_checkIfRecordsAssignToUser($deletedCrmIds, $group);
$assignedDeletedRecordIds = array_merge($assignedDeletedRecordIds, $groupRecordId);
}
}
}
// End
foreach ($deletedRecords as $index => $record) {
$idComp = vtws_getIdComponents($record);
if (empty($hasDeleteAccess)) {
$handler = vtws_getModuleHandlerFromId($idComp[0], $this->user);
$meta = $handler->getMeta();
$hasDeleteAccess = $meta->hasDeleteAccess();
}
if ($hasDeleteAccess) {
if (in_array($idComp[1], $assignedDeletedRecordIds)) {
try {
vtws_delete($record, $this->user);
} catch (Exception $e) {
continue;
}
}
}
}
$recordDetails['created'] = $createdRecords;
$recordDetails['updated'] = $updatedRecords;
$recordDetails['deleted'] = $deletedRecords;
//.........这里部分代码省略.........
示例11: checkUserPermissions
public function checkUserPermissions()
{
$log = vglobal('log');
$log->debug('Entering ' . __CLASS__ . '::' . __METHOD__ . '() method ...');
$permissions = $this->get('permissions');
if (empty($permissions)) {
$log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...');
return true;
}
$currentUser = Users_Record_Model::getCurrentUserModel();
$permissions = explode(',', $permissions);
if (in_array('Users:' . $currentUser->getId(), $permissions)) {
// check user id
$log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...');
return true;
} else {
$userGroups = new GetUserGroups();
$userGroups->getAllUserGroups($currentUser->getId());
foreach ($userGroups->user_groups as $group) {
if (in_array('Groups:' . $group, $permissions)) {
$log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...');
return true;
}
}
}
$log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...');
return false;
}
示例12: vtlib_purify
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once 'include/utils/GetUserGroups.php';
require_once 'Smarty_setup.php';
$user_id = vtlib_purify($_REQUEST['record']);
global $current_user;
global $mod_strings;
$smarty = new vtigerCRM_Smarty();
$oGetUserGroups = new GetUserGroups();
$oGetUserGroups->getAllUserGroups($user_id);
$user_group_info = array();
foreach ($oGetUserGroups->user_groups as $groupid) {
$user_group_info[$groupid] = getGroupDetails($groupid);
}
$smarty->assign("IS_ADMIN", is_admin($current_user));
$smarty->assign("GROUPLIST", $user_group_info);
$smarty->assign("UMOD", $mod_strings);
$smarty->display("UserGroups.tpl");
示例13: getSelectedValuesToSmarty
//.........这里部分代码省略.........
$sel_fields = Zend_Json::encode($this->adv_sel_fields);
$smarty_obj->assign("SEL_FIELDS", $sel_fields);
global $default_charset;
$std_filter_columns = $this->getStdFilterColumns();
$std_filter_columns_js = implode("<%jsstdjs%>", $std_filter_columns);
$std_filter_columns_js = html_entity_decode($std_filter_columns_js, ENT_QUOTES, $default_charset);
$smarty_obj->assign("std_filter_columns", $std_filter_columns_js);
$std_filter_criteria = Zend_Json::encode($this->Date_Filter_Values);
$smarty_obj->assign("std_filter_criteria", $std_filter_criteria);
}
$rel_fields = $this->adv_rel_fields;
$smarty_obj->assign("REL_FIELDS", Zend_Json::encode($rel_fields));
// NEW ADVANCE FILTERS END
$BLOCKJS = $this->getCriteriaJS();
$smarty_obj->assign("BLOCKJS_STD", $BLOCKJS);
}
if (in_array($step_name, array("ReportSharing", $get_all_steps))) {
$roleid = $this->current_user->column_fields['roleid'];
$user_array = getRoleAndSubordinateUsers($roleid);
$userIdStr = "";
$userNameStr = "";
$m = 0;
foreach ($user_array as $userid => $username) {
if ($userid != $this->current_user->id) {
if ($m != 0) {
$userIdStr .= ",";
$userNameStr .= ",";
}
$userIdStr .= "'" . $userid . "'";
$userNameStr .= "'" . escape_single_quotes(decode_html($username)) . "'";
$m++;
}
}
require_once 'include/utils/GetUserGroups.php';
// ITS4YOU-UP SlOl 26. 4. 2013 9:47:59
$template_owners = get_user_array(false);
if (isset($this->reportinformations["owner"]) && $this->reportinformations["owner"] != "") {
$selected_owner = $this->reportinformations["owner"];
} else {
$selected_owner = $this->current_user->id;
}
$smarty_obj->assign("TEMPLATE_OWNERS", $template_owners);
$owner = isset($_REQUEST['template_owner']) && $_REQUEST['template_owner'] != '' ? $_REQUEST['template_owner'] : $selected_owner;
$smarty_obj->assign("TEMPLATE_OWNER", $owner);
$sharing_types = array("public" => vtranslate("PUBLIC_FILTER"), "private" => vtranslate("PRIVATE_FILTER"), "share" => vtranslate("SHARE_FILTER"));
$smarty_obj->assign("SHARINGTYPES", $sharing_types);
$sharingtype = "public";
if (isset($_REQUEST['sharing']) && $_REQUEST['sharing'] != '') {
$sharingtype = $_REQUEST['sharing'];
} elseif (isset($this->reportinformations["sharingtype"]) && $this->reportinformations["sharingtype"] != "") {
$sharingtype = $this->reportinformations["sharingtype"];
}
$smarty_obj->assign("SHARINGTYPE", $sharingtype);
$cmod = return_specified_module_language($current_language, "Settings");
$smarty_obj->assign("CMOD", $cmod);
$sharingMemberArray = array();
if (isset($_REQUEST['sharingSelectedColumns']) && $_REQUEST['sharingSelectedColumns'] != '') {
$sharingMemberArray = explode("|", trim($_REQUEST['sharingSelectedColumns'], "|"));
} elseif (isset($this->reportinformations["members_array"]) && !empty($this->reportinformations["members_array"])) {
$sharingMemberArray = $this->reportinformations["members_array"];
}
$sharingMemberArray = array_unique($sharingMemberArray);
if (count($sharingMemberArray) > 0) {
$outputMemberArr = array();
foreach ($sharingMemberArray as $setype => $shareIdArr) {
$shareIdArr = explode("::", $shareIdArr);
示例14: foreach
$userIdStr = "";
$userNameStr = "";
$m = 0;
foreach ($user_array as $userid => $username) {
if ($userid != $current_user->id) {
if ($m != 0) {
$userIdStr .= ",";
$userNameStr .= ",";
}
$userIdStr .= "'" . $userid . "'";
$userNameStr .= "'" . escape_single_quotes(decode_html($username)) . "'";
$m++;
}
}
require_once 'include/utils/GetUserGroups.php';
$userGroups = new GetUserGroups();
$userGroups->getAllUserGroups($current_user->id);
$user_groups = $userGroups->user_groups;
$groupIdStr = "";
$groupNameStr = "";
$l = 0;
foreach ($user_groups as $i => $grpid) {
$grp_details = getGroupDetails($grpid);
if ($l != 0) {
$groupIdStr .= ",";
$groupNameStr .= ",";
}
$groupIdStr .= "'" . $grp_details[0] . "'";
$groupNameStr .= "'" . escape_single_quotes(decode_html($grp_details[1])) . "'";
$l++;
}