本文整理汇总了PHP中query_module_access_list函数的典型用法代码示例。如果您正苦于以下问题:PHP query_module_access_list函数的具体用法?PHP query_module_access_list怎么用?PHP query_module_access_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了query_module_access_list函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testget_user_disallowed_modules
public function testget_user_disallowed_modules()
{
//execute the method and test it it returns expected contents
$expected = array('Bugs' => 'Bugs', 'ResourceCalendar' => 'ResourceCalendar', 'AOBH_BusinessHours' => 'AOBH_BusinessHours', 'AOR_Scheduled_Reports' => 'AOR_Scheduled_Reports', 'SecurityGroups' => 'SecurityGroups');
$allowed = query_module_access_list(new User('1'));
$actual = get_user_disallowed_modules('1', $allowed);
$this->assertSame($expected, $actual);
}
示例2: setUp
public function setUp()
{
global $moduleList, $beanList, $beanFiles;
require 'include/modules.php';
$GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
$GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
$GLOBALS['modules_exempt_from_availability_check']['Calls'] = 'Calls';
$GLOBALS['modules_exempt_from_availability_check']['Meetings'] = 'Meetings';
$this->bean = new Opportunity();
}
示例3: sm_build_array
function sm_build_array()
{
//if the sitemap array is already stored, then pass it back
if (isset($_SESSION['SM_ARRAY']) && !empty($_SESSION['SM_ARRAY'])) {
return $_SESSION['SM_ARRAY'];
}
include "include/modules.php";
global $sugar_config, $mod_strings;
// Need to set up mod_strings when we iterate through module menus.
$orig_modstrings = array();
if (!empty($mod_strings)) {
$orig_modstrings = $mod_strings;
}
if (isset($_SESSION['authenticated_user_language']) && $_SESSION['authenticated_user_language'] != '') {
$current_language = $_SESSION['authenticated_user_language'];
} else {
$current_language = $sugar_config['default_language'];
}
$exclude = array();
// in case you want to exclude any.
$mstr_array = array();
global $modListHeader;
if (!isset($modListHeader)) {
global $current_user;
if (isset($current_user)) {
$modListHeader = query_module_access_list($current_user);
}
}
foreach ($modListHeader as $key => $val) {
if (!empty($exclusion_array) && in_array($val, $exclude)) {
continue;
} else {
if (file_exists('modules/' . $val . '/Menu.php')) {
$mod_strings = return_module_language($current_language, $val);
$module_menu = array();
include 'modules/' . $val . '/Menu.php';
$tmp_menu_items = array();
foreach ($module_menu as $menu) {
if (isset($menu[0]) && !empty($menu[0]) && isset($menu[1]) && !empty($menu[1]) && trim($menu[0]) != '#') {
$tmp_menu_items[$menu[1]] = $menu[0];
}
}
$mstr_array[$val] = $tmp_menu_items;
}
}
}
//reset the modstrings to current module
$mod_strings = $orig_modstrings;
//store master array into session variable
$_SESSION['SM_ARRAY'] = $mstr_array;
return $mstr_array;
}
示例4: display
public function display()
{
global $dictionary;
global $current_user;
global $beanList, $beanFiles;
global $app_list_strings;
echo $this->getModuleTitle();
$this->ss->assign("RETURN_MODULE", "Administration");
$this->ss->assign("RETURN_ACTION", "index");
$config = new ZendeskWidgetConfig();
$records = array();
foreach (query_module_access_list($current_user) as $module) {
if ($object_name = $beanList[$module]) {
if (!in_array($object_name, array('zd_Tickets'))) {
$bean = $this->getBeanInstance($object_name);
$field_config = $config->getFields($module);
$records[$module] = array('key' => $module, 'name' => $app_list_strings['moduleList'][$module], 'enabled' => $field_config != null && $field_config != '', 'fields' => $this->getRecordFields($bean), 'current' => $field_config);
}
}
}
usort($records, "namecmp");
$this->ss->assign('records', $records);
$this->ss->display('modules/zd_Tickets/tpls/crmdataconfig.tpl');
}
示例5: handleAccessControl
/**
* Handles everything related to authorization.
*/
function handleAccessControl()
{
if ($GLOBALS['current_user']->isDeveloperForAnyModule()) {
return;
}
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == "RetrieveEmail") {
return;
}
if (!is_admin($GLOBALS['current_user']) && !empty($GLOBALS['adminOnlyList'][$this->controller->module]) && !empty($GLOBALS['adminOnlyList'][$this->controller->module]['all']) && (empty($GLOBALS['adminOnlyList'][$this->controller->module][$this->controller->action]) || $GLOBALS['adminOnlyList'][$this->controller->module][$this->controller->action] != 'allow')) {
$this->controller->hasAccess = false;
return;
}
// Bug 20916 - Special case for check ACL access rights for Subpanel QuickCreates
if (isset($_POST['action']) && $_POST['action'] == 'SubpanelCreates') {
$actual_module = $_POST['target_module'];
if (!empty($GLOBALS['modListHeader']) && !in_array($actual_module, $GLOBALS['modListHeader'])) {
$this->controller->hasAccess = false;
}
return;
}
if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) {
$GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
}
if (in_array($this->controller->module, $GLOBALS['modInvisList']) && (in_array('Activities', $GLOBALS['moduleList']) && in_array('Calendar', $GLOBALS['moduleList']) && in_array($this->controller->module, $GLOBALS['modInvisListActivities']))) {
$this->controller->hasAccess = false;
return;
}
}
示例6: getSubpanels
/**
* Gets a list of subpanels used by the current module
*/
function getSubpanels()
{
if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) {
$GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
}
require_once 'include/SubPanel/SubPanel.php';
$nodes = array();
$GLOBALS['log']->debug("StudioModule->getSubpanels(): getting subpanels for " . $this->module);
// counter to add a unique key to assoc array below
$ct = 0;
foreach (SubPanel::getModuleSubpanels($this->module) as $name => $label) {
if ($name == 'users') {
continue;
}
$subname = sugar_ucfirst(!empty($label) ? translate($label, $this->module) : $name);
$action = "module=ModuleBuilder&action=editLayout&view=ListView&view_module={$this->module}&subpanel={$name}&subpanelLabel=" . urlencode($subname);
// bug47452 - adding a unique number to the $nodes[ key ] so if you have 2+ panels
// with the same subname they will not cancel each other out
$nodes[$subname . $ct++] = array('name' => $name, 'label' => $subname, 'action' => $action, 'imageTitle' => $subname, 'imageName' => 'icon_' . ucfirst($name) . '_32', 'altImageName' => 'Subpanels', 'size' => '48');
}
return $nodes;
}
示例7: action_SaveRelationship
function action_SaveRelationship()
{
if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) {
$GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
}
if (empty($_REQUEST['view_package'])) {
require_once 'modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php';
$relationships = new DeployedRelationships($_REQUEST['view_module']);
} else {
$mb = new ModuleBuilder();
$module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
require_once 'modules/ModuleBuilder/parsers/relationships/UndeployedRelationships.php';
$relationships = new UndeployedRelationships($module->getModuleDir());
}
$relationships->addFromPost();
$relationships->save();
$GLOBALS['log']->debug("\n\nSTART BUILD");
if (empty($_REQUEST['view_package'])) {
$relationships->build();
LanguageManager::clearLanguageCache($_REQUEST['view_module']);
}
$GLOBALS['log']->debug("\n\nEND BUILD");
$this->view = 'relationships';
}
示例8: getSubpanels
/**
* Gets a list of subpanels used by the current module
*/
function getSubpanels()
{
if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) {
$GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
}
require_once 'include/SubPanel/SubPanel.php';
$nodes = array();
$GLOBALS['log']->debug("StudioModule->getSubpanels(): getting subpanels for " . $this->module);
foreach (SubPanel::getModuleSubpanels($this->module) as $name => $label) {
if ($name == 'users') {
continue;
}
$subname = sugar_ucfirst(!empty($label) ? translate($label, $this->module) : $name);
$nodes[$subname] = array('name' => $name, 'label' => $subname, 'action' => "module=ModuleBuilder&action=editLayout&view=ListView&view_module={$this->module}&subpanel={$name}&subpanelLabel={$subname}", 'imageTitle' => $subname, 'imageName' => 'icon_' . ucfirst($name) . '_32', 'altImageName' => 'Subpanels', 'size' => '48');
}
return $nodes;
}
示例9: get_available_tabs
/**
* This function returns an ordered list of all "tabs", actually subpanels, for this module
* The source list is obtained from the subpanel layout contained in the layout_defs for this module,
* found either in the modules metadata/subpaneldefs.php file, or in the modules custom/.../Ext/Layoutdefs/layoutdefs.ext.php file
* and filtered through an ACL check.
* Note that the keys for the resulting array of tabs are in practice the name of the underlying source relationship for the subpanel
* So for example, the key for a custom module's subpanel with Accounts might be 'one_one_accounts', as generated by the Studio Relationship Editor
* Although OOB module subpanels have keys such as 'accounts', which might on the face of it appear to be a reference to the related module, in fact 'accounts' is still the relationship name
* @param boolean Optional - include the subpanel title label in the return array (false)
* @return array All tabs that pass an ACL check
*/
function get_available_tabs($FromGetModuleSubpanels = false)
{
global $modListHeader;
global $modules_exempt_from_availability_check;
if (isset($this->_visible_tabs_array)) {
return $this->_visible_tabs_array;
}
if (empty($modListHeader)) {
$modListHeader = query_module_access_list($GLOBALS['current_user']);
}
$this->_visible_tabs_array = array();
// bug 16820 - make sure this is an array for the later ksort
if (isset($this->layout_defs['subpanel_setup'])) {
//retrieve list of hidden subpanels
$hidden_panels = $this->get_hidden_subpanels();
//activities is a special use case in that if it is hidden,
//then the history tab should be hidden too.
if (!empty($hidden_panels) && is_array($hidden_panels) && in_array('activities', $hidden_panels)) {
//add history to list hidden_panels
$hidden_panels['history'] = 'history';
}
foreach ($this->layout_defs['subpanel_setup'] as $key => $values_array) {
//exclude if this subpanel is hidden from admin screens
$module = $key;
if (isset($values_array['module'])) {
$module = strtolower($values_array['module']);
}
if ($hidden_panels && is_array($hidden_panels) && (in_array($module, $hidden_panels) || array_key_exists($module, $hidden_panels))) {
//this panel is hidden, skip it
continue;
}
// make sure the module attribute is set, else none of this works...
if (!isset($values_array['module'])) {
$GLOBALS['log']->debug("SubPanelDefinitions->get_available_tabs(): no module defined in subpaneldefs for '{$key}' =>" . var_export($values_array, true) . " - ingoring subpanel defintion");
continue;
}
//check permissions.
$exempt = array_key_exists($values_array['module'], $modules_exempt_from_availability_check);
$ok = $exempt || (!ACLController::moduleSupportsACL($values_array['module']) || ACLController::checkAccess($values_array['module'], 'list', true));
$GLOBALS['log']->debug("SubPanelDefinitions->get_available_tabs(): " . $key . "= " . ($exempt ? "exempt " : "not exempt " . ($ok ? " ACL OK" : "")));
if ($ok) {
while (!empty($this->_visible_tabs_array[$values_array['order']])) {
$values_array['order']++;
}
$this->_visible_tabs_array[$values_array['order']] = $FromGetModuleSubpanels ? array($key => $values_array['title_key']) : $key;
}
}
}
ksort($this->_visible_tabs_array);
return $this->_visible_tabs_array;
}
示例10: _getModuleTab
/**
* Returns the module name which should be highlighted in the module menu
*/
protected function _getModuleTab()
{
global $app_list_strings, $moduleTabMap, $current_user;
$userTabs = query_module_access_list($current_user);
//If the home tab is in the user array use it as the default tab, otherwise use the first element in the tab array
$defaultTab = in_array("Home", $userTabs) ? "Home" : key($userTabs);
// Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.
if (!empty($_REQUEST['module_tab'])) {
return $_REQUEST['module_tab'];
} elseif (isset($moduleTabMap[$this->module])) {
return $moduleTabMap[$this->module];
} elseif ($this->module == 'MergeRecords') {
return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module'];
} elseif ($this->module == 'Users' && $this->action == 'SetTimezone') {
return $defaultTab;
} elseif (!isset($app_list_strings['moduleList'][$this->module])) {
return $defaultTab;
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui") {
return $defaultTab;
} else {
return $this->module;
}
}
示例11: load_sub_subpanels
/**
* Load the Sub-Panel objects if it can from the metadata files.
*
* call this function for sub-panels that have unions.
*
* @return bool True by default if the subpanel was loaded. Will return false if none in the collection are
* allowed by the current user.
*/
function load_sub_subpanels()
{
global $modListHeader;
// added a check for security of tabs to see if an user has access to them
// this prevents passing an "unseen" tab to the query string and pulling up its contents
if (!isset($modListHeader)) {
global $current_user;
if (isset($current_user)) {
$modListHeader = query_module_access_list($current_user);
}
}
//by default all the activities modules are exempt, so hiding them won't affect their appearance unless the 'activity' subpanel itself is hidden.
//add email to the list temporarily so it is not affected in activities subpanel
global $modules_exempt_from_availability_check;
$modules_exempt_from_availability_check['Emails'] = 'Emails';
$listFieldMap = array();
if (empty($this->sub_subpanels)) {
$panels = $this->get_inst_prop_value('collection_list');
foreach ($panels as $panel => $properties) {
if (array_key_exists($properties['module'], $modListHeader) or array_key_exists($properties['module'], $modules_exempt_from_availability_check)) {
$this->sub_subpanels[$panel] = new CustomaSubPanel($panel, $properties, $this->parent_bean, false, false, $this->search_query);
}
}
// if it's empty just dump out as there is nothing to process.
if (empty($this->sub_subpanels)) {
return false;
}
//Sync displayed list fields across the subpanels
$display_fields = $this->getDisplayFieldsFromCollection($this->sub_subpanels);
$query_fields = array();
foreach ($this->sub_subpanels as $key => $subpanel) {
$list_fields = $subpanel->get_list_fields();
$listFieldMap[$key] = array();
$index = 0;
foreach ($list_fields as $field => $def) {
if (isset($def['vname']) && isset($def['width'])) {
$index++;
if (!empty($def['alias'])) {
$listFieldMap[$key][$def['alias']] = $field;
} else {
$listFieldMap[$key][$field] = $field;
}
if (!isset($display_fields[$def['vname']])) {
if (sizeof($display_fields) > $index) {
//Try to insert the new field in an order that makes sense
$start = array_slice($display_fields, 0, $index);
$end = array_slice($display_fields, $index);
$display_fields = array_merge($start, array($def['vname'] => array('name' => $field, 'vname' => $def['vname'], 'width' => $def['width'])), $end);
} else {
$display_fields[$def['vname']] = array('name' => empty($def['alias']) ? $field : $def['alias'], 'vname' => $def['vname'], 'width' => $def['width']);
}
}
} else {
$query_fields[$field] = $def;
}
}
}
foreach ($this->sub_subpanels as $key => $subpanel) {
$list_fields = array();
foreach ($display_fields as $vname => $def) {
$field = $def['name'];
$list_key = isset($listFieldMap[$key][$field]) ? $listFieldMap[$key][$field] : $field;
if (isset($subpanel->panel_definition['list_fields'][$field])) {
$list_fields[$field] = $subpanel->panel_definition['list_fields'][$field];
} else {
if ($list_key != $field && isset($subpanel->panel_definition['list_fields'][$list_key])) {
$list_fields[$list_key] = $subpanel->panel_definition['list_fields'][$list_key];
} else {
$list_fields[$field] = $display_fields[$vname];
}
}
}
foreach ($query_fields as $field => $def) {
if (isset($subpanel->panel_definition['list_fields'][$field])) {
$list_fields[$field] = $subpanel->panel_definition['list_fields'][$field];
} else {
$list_fields[$field] = $def;
}
}
$subpanel->panel_definition['list_fields'] = $list_fields;
}
}
return true;
}
示例12: action_SaveRelationship
public function action_SaveRelationship()
{
if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) {
$GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
}
if (empty($_REQUEST['view_package'])) {
$relationships = new DeployedRelationships($_REQUEST['view_module']);
} else {
$mb = new ModuleBuilder();
$module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
$relationships = new UndeployedRelationships($module->getModuleDir());
}
$relationships->addFromPost();
// Since the build() call below will call save() again, save the rebuild
// of relationship metadata for now
$relationships->save(false);
$GLOBALS['log']->debug("\n\nSTART BUILD");
if (empty($_REQUEST['view_package'])) {
$relationships->build();
LanguageManager::clearLanguageCache($_REQUEST['view_module']);
}
$GLOBALS['log']->debug("\n\nEND BUILD");
$this->view = 'relationships';
}
示例13: get_user_module_list
function get_user_module_list($user)
{
global $app_list_strings;
$app_list_strings = return_app_list_strings_language($current_language);
$modules = query_module_access_list($user);
ACLController::filterModuleList($modules, false);
global $modInvisList, $modInvisListActivities;
foreach ($modInvisList as $invis) {
$modules[$invis] = 'read_only';
}
if (isset($modules['Calendar']) || $modules['Activities']) {
foreach ($modInvisListActivities as $invis) {
$modules[$invis] = $invis;
}
}
return $modules;
}
示例14: handleAccessControl
/**
* Handles everything related to authorization.
*/
function handleAccessControl()
{
if (is_admin($GLOBALS['current_user']) || is_admin_for_any_module($GLOBALS['current_user'])) {
return;
}
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == "RetrieveEmail") {
return;
}
if (!is_admin($GLOBALS['current_user']) && !empty($GLOBALS['adminOnlyList'][$this->controller->module]) && !empty($GLOBALS['adminOnlyList'][$this->controller->module]['all']) && (empty($GLOBALS['adminOnlyList'][$this->controller->module][$this->controller->action]) || $GLOBALS['adminOnlyList'][$this->controller->module][$this->controller->action] != 'allow')) {
$this->controller->hasAccess = false;
return;
}
if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) {
$GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
}
if (in_array($this->controller->module, $GLOBALS['modInvisList']) && (in_array('Activities', $GLOBALS['moduleList']) && in_array('Calendar', $GLOBALS['moduleList']) && in_array($this->controller->module, $GLOBALS['modInvisListActivities']))) {
$this->controller->hasAccess = false;
return;
}
}
示例15: _buildModuleList
protected function _buildModuleList()
{
if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) {
$GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
}
}