cleanProfile() public method

Unset unused rights for helpdesk
public cleanProfile ( )
Exemplo n.º 1
0
/**
 * Change active profile to the $ID one. Update glpiactiveprofile session variable.
 *
 * @param $ID : ID of the new profile
 *
 * @return Nothing
**/
function changeProfile($ID)
{
    if (isset($_SESSION['glpiprofiles'][$ID]) && count($_SESSION['glpiprofiles'][$ID]['entities'])) {
        $profile = new Profile();
        if ($profile->getFromDB($ID)) {
            $profile->cleanProfile();
            $data = $profile->fields;
            $data['entities'] = $_SESSION['glpiprofiles'][$ID]['entities'];
            $_SESSION['glpiactiveprofile'] = $data;
            $_SESSION['glpiactiveentities'] = array();
            Search::resetSaveSearch();
            $active_entity_done = false;
            // Try to load default entity if it is a root entity
            foreach ($data['entities'] as $key => $val) {
                if ($val['id'] == $_SESSION["glpidefault_entity"]) {
                    if (changeActiveEntities($val['id'], $val['is_recursive'])) {
                        $active_entity_done = true;
                    }
                }
            }
            if (!$active_entity_done) {
                // Try to load default entity
                if (!changeActiveEntities($_SESSION["glpidefault_entity"], true)) {
                    // Load all entities
                    changeActiveEntities("all");
                }
            }
            doHook("change_profile");
        }
    }
    // Clean specific datas
    if (isset($_SESSION['glpi_faqcategories'])) {
        unset($_SESSION['glpi_faqcategories']);
    }
}
Exemplo n.º 2
0
             $current_config = $config_object->fields;
         }
     }
 }
 if (count($current_config) > 0) {
     $CFG_GLPI = array_merge($CFG_GLPI, $current_config);
     if (isset($CFG_GLPI['priority_matrix'])) {
         $CFG_GLPI['priority_matrix'] = importArrayFromDB($CFG_GLPI['priority_matrix'], true);
     }
     if (isset($CFG_GLPI['lock_item_list'])) {
         $CFG_GLPI['lock_item_list'] = importArrayFromDB($CFG_GLPI['lock_item_list']);
     }
     if (isset($CFG_GLPI['lock_lockprofile_id']) && $CFG_GLPI["lock_use_lock_item"] && $CFG_GLPI["lock_lockprofile_id"] > 0 && !isset($CFG_GLPI['lock_lockprofile'])) {
         $prof = new Profile();
         $prof->getFromDB($CFG_GLPI["lock_lockprofile_id"]);
         $prof->cleanProfile();
         $CFG_GLPI['lock_lockprofile'] = $prof->fields;
     }
     // Path for icon of document type (web mode only)
     if (isset($CFG_GLPI["root_doc"])) {
         $CFG_GLPI["typedoc_icon_dir"] = $CFG_GLPI["root_doc"] . "/pics/icones";
     }
 } else {
     echo "Error accessing config table";
     exit;
 }
 if (isCommandLine() && isset($_SERVER['argv'])) {
     $key = array_search('--debug', $_SERVER['argv']);
     if ($key) {
         $_SESSION['glpi_use_mode'] = Session::DEBUG_MODE;
         unset($_SERVER['argv'][$key]);