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);
 }
Beispiel #2
0
 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();
 }
Beispiel #3
0
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;
}
Beispiel #4
0
 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');
 }
Beispiel #5
0
 /**
  * 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;
     }
 }
 /**
  * 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;
 }
Beispiel #7
0
 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';
 }
Beispiel #8
0
 /**
  * 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;
 }
 /**
  * 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;
 }
Beispiel #10
0
 /**
  * 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;
     }
 }
 /**
  * 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;
 }
Beispiel #12
0
 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';
 }
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;
}
 /**
  * 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;
     }
 }
Beispiel #15
0
 protected function _buildModuleList()
 {
     if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) {
         $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
     }
 }
Beispiel #16
0
function get_user_module_list($user)
{
    global $app_list_strings, $current_language;
    $app_list_strings = return_app_list_strings_language($current_language);
    $modules = query_module_access_list($user);
    global $modInvisList, $modInvisListActivities;
    if (isset($modules['Calendar']) || $modules['Activities']) {
        foreach ($modInvisListActivities as $invis) {
            $modules[$invis] = $invis;
        }
    }
    return $modules;
}
 /**
  * This function returns an ordered list of the tabs.
  */
 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'])) {
         foreach ($this->layout_defs['subpanel_setup'] as $key => $values_array) {
             //check permissions.
             $result = '';
             if (array_key_exists($values_array['module'], $modules_exempt_from_availability_check)) {
                 $result .= 'exempt ';
             }
             if (array_key_exists($values_array['module'], $modListHeader)) {
                 $result .= "not exempt ";
                 if (!ACLController::moduleSupportsACL($values_array['module']) || ACLController::checkAccess($values_array['module'], 'list', true)) {
                     $result .= "ACL ok";
                 }
             }
             $GLOBALS['log']->debug("SubPanelDefinitions->get_available_tabs(): " . $key . "=" . $result);
             if (array_key_exists($values_array['module'], $modules_exempt_from_availability_check) or !ACLController::moduleSupportsACL($values_array['module']) || ACLController::checkAccess($values_array['module'], 'list', true)) {
                 while (!empty($this->_visible_tabs_array[$values_array['order']])) {
                     $values_array['order']++;
                 }
                 if ($FromGetModuleSubpanels) {
                     $this->_visible_tabs_array[$values_array['order']] = array($key => $values_array['title_key']);
                 } else {
                     $this->_visible_tabs_array[$values_array['order']] = $key;
                 }
             }
         }
     }
     //		$GLOBALS['log']->debug("SubPanelDefinitions->get_available_tabs(): visible_tabs_array = ".print_r($this->_visible_tabs_array,true));
     ksort($this->_visible_tabs_array);
     return $this->_visible_tabs_array;
 }
 function get_user_module_list($user)
 {
     $GLOBALS['log']->info('Begin: SoapHelperWebServices->get_user_module_list');
     global $app_list_strings, $current_language;
     $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;
         }
     }
     $GLOBALS['log']->info('End: SoapHelperWebServices->get_user_module_list');
     return $modules;
 }
function get_user_module_list($user)
{
    global $app_list_strings, $current_language, $beanList, $beanFiles;
    $app_list_strings = return_app_list_strings_language($current_language);
    $modules = query_module_access_list($user);
    ACLController::filterModuleList($modules, false);
    global $modInvisList;
    foreach ($modInvisList as $invis) {
        $modules[$invis] = 'read_only';
    }
    $actions = ACLAction::getUserActions($user->id, true);
    foreach ($actions as $key => $value) {
        if (isset($value['module']) && $value['module']['access']['aclaccess'] < ACL_ALLOW_ENABLED) {
            if ($value['module']['access']['aclaccess'] == ACL_ALLOW_DISABLED) {
                unset($modules[$key]);
            } else {
                $modules[$key] = 'read_only';
            }
            // else
        } else {
            $modules[$key] = '';
        }
        // else
    }
    // foreach
    //Remove all modules that don't have a beanFiles entry associated with it
    foreach ($modules as $module_name => $module) {
        if (isset($beanList[$module_name])) {
            $class_name = $beanList[$module_name];
            if (empty($beanFiles[$class_name])) {
                unset($modules[$module_name]);
            }
        } else {
            unset($modules[$module_name]);
        }
    }
    return $modules;
}
Beispiel #20
0
function get_user_module_list($user)
{
    global $app_list_strings, $current_language;
    $app_list_strings = return_app_list_strings_language($current_language);
    $modules = query_module_access_list($user);
    global $modInvisList;
    return $modules;
}
 function get_user_module_list($user)
 {
     $GLOBALS['log']->info('Begin: SoapHelperWebServices->get_user_module_list');
     global $app_list_strings, $current_language;
     $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;
         }
     }
     $actions = ACLAction::getUserActions($user->id, true);
     foreach ($actions as $key => $value) {
         if (isset($value['module']) && $value['module']['access']['aclaccess'] < ACL_ALLOW_ENABLED) {
             if ($value['module']['access']['aclaccess'] == ACL_ALLOW_DISABLED) {
                 unset($modules[$key]);
             } else {
                 $modules[$key] = 'read_only';
             }
             // else
         } else {
             $modules[$key] = '';
         }
         // else
     }
     // foreach
     $GLOBALS['log']->info('End: SoapHelperWebServices->get_user_module_list');
     return $modules;
 }
Beispiel #22
0
 /**
  * Registration of $modListHeader in global scope
  *
  * @static
  * @return bool is variable setuped or not
  */
 protected static function setUp_modListHeader()
 {
     self::$registeredVars['modListHeader'] = true;
     if (isset($GLOBALS['current_user']) == false) {
         self::setUp_current_user(array(true, 1));
     }
     $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
     return true;
 }
Beispiel #23
0
// For each tab that is off, parse a tab_off.
// For the current tab, parse a tab_on
$modListHeader = $moduleList;
if (isset($current_user->id)) {
    if ($action == 'Login') {
        if ($sugar_config['login_nav'] == false) {
            $modListHeader = array();
        }
    } else {
        $modListHeader = query_module_access_list($current_user);
    }
} else {
    if ($action == 'Login' && $sugar_config['login_nav'] == false) {
        $modListHeader = array();
    } else {
        $modListHeader = query_module_access_list($current_user);
    }
}
$modListHeader = get_val_array($modListHeader);
if (isset($current_user->id)) {
    $user_max_tabs = $current_user->getPreference('max_tabs');
    if (intval($user_max_tabs) > 0) {
        $max_tabs = intval($user_max_tabs);
    }
}
$modListHeaderClone = $modListHeader;
require_once 'modules/iFrames/iFrame.php';
$iFrame = new iFrame();
$frames = $iFrame->lookup_frames('tab');
foreach ($frames as $name => $values) {
    $modListHeaderClone[$name] = $values;
 function crmdata($session, $email)
 {
     global $dictionary;
     global $app_list_strings;
     global $current_user;
     global $beanList, $beanFiles;
     if (!self::$helperObject->checkSessionAndModuleAccess($session, 'invalid_session', 'Accounts', 'read', 'no_access', new SoapError())) {
         echo "No access";
         return;
     }
     $field_list = array();
     $config = new ZendeskWidgetConfig();
     foreach (query_module_access_list($current_user) as $module) {
         if ($object_name = $beanList[$module]) {
             $field_config = $config->getFields($module);
             if ($field_config != null && $field_config != '') {
                 $field_list[$object_name] = $field_config;
             }
         }
     }
     $root = new SimpleXMLElement('<records></records>');
     $ea = new EmailAddress();
     $beans = $ea->getBeansByEmailAddress($email);
     while ($bean = array_pop($beans)) {
         if (isset($field_list[$bean->object_name])) {
             $record = $root->addChild('record');
             $record->addChild('id', $bean->id);
             $record->addChild('url', htmlspecialchars("/index.php?module={$bean->module_dir}&action=DetailView&record={$bean->id}"));
             $record->addChild('label', $bean->name);
             $record->addChild('record_type', $bean->object_name);
             $fields = $record->addChild('fields');
             foreach (split(',', $field_list[$bean->object_name]) as $name) {
                 $field_meta = $dictionary[$bean->object_name]['fields'][$name];
                 if ($field_meta['type'] == 'relate') {
                     if ($field_meta['dbType'] == 'id') {
                         $beanType = get_singular_bean_name($field_meta['module']);
                         $newBean = $this->getBeanInstance($beanType);
                         $newBean->retrieve($bean->{$name});
                         $beans[] = $newBean;
                         continue;
                     }
                 }
                 $field = $fields->addChild('field');
                 $field->addChild('label', translate($field_meta['vname'], $bean->module_dir));
                 $value = $bean->{$name};
                 if ($field_meta['type'] == 'enum') {
                     $value = $app_list_strings[$field_meta['options']][$bean->{$name}];
                 }
                 $field->addChild('value', $value);
             }
         }
     }
     return $root->asXML();
 }