static function removeRightsFromSession()
 {
     $profile = new self();
     foreach ($profile->getAllRights() as $right) {
         if (isset($_SESSION['glpiactiveprofile'][$right['field']])) {
             unset($_SESSION['glpiactiveprofile'][$right['field']]);
         }
     }
     ProfileRight::deleteProfileRights(array($right['field']));
 }
示例#2
0
 /**
  * Delete type from the rights
  * @param name the name of the type
  * @return nothing
  */
 public static function deleteTypeFromProfile($itemtype)
 {
     $rights = array();
     $rights[] = self::getProfileNameForItemtype($itemtype);
     ProfileRight::deleteProfileRights($rights);
 }
 static function removeRightsFromSession()
 {
     $profile = new self();
     foreach ($profile->getAllRights() as $right) {
         if (isset($_SESSION['glpiactiveprofile'][$right['field']])) {
             unset($_SESSION['glpiactiveprofile'][$right['field']]);
         }
     }
     ProfileRight::deleteProfileRights(array($right['field']));
     if (isset($_SESSION['glpimenu']['plugins']['types']['PluginFusioninventoryMenu'])) {
         unset($_SESSION['glpimenu']['plugins']['types']['PluginFusioninventoryMenu']);
     }
     if (isset($_SESSION['glpimenu']['plugins']['content']['pluginfusioninventorymenu'])) {
         unset($_SESSION['glpimenu']['plugins']['content']['pluginfusioninventorymenu']);
     }
     if (isset($_SESSION['glpimenu']['assets']['types']['PluginFusioninventoryUnmanaged'])) {
         unset($_SESSION['glpimenu']['plugins']['types']['PluginFusioninventoryUnmanaged']);
     }
     if (isset($_SESSION['glpimenu']['assets']['content']['pluginfusioninventoryunmanaged'])) {
         unset($_SESSION['glpimenu']['assets']['content']['pluginfusioninventoryunmanaged']);
     }
 }
示例#4
0
 function pre_deleteItem()
 {
     if ($this->getFromDB($this->fields["id"])) {
         $name = $this->fields['name'];
         $itemtype = $this->fields['itemtype'];
         //Delete all network ports
         self::deleteNetworking($itemtype);
         //Drop all dropdowns associated with itemtype
         self::deleteDropdownsForItemtype($itemtype);
         //Delete loans associated with this type
         self::deleteLoans($itemtype);
         //Delete loans associated with this type
         self::deleteUnicity($itemtype);
         //Delete reservations with this tyoe
         self::deleteReservations($itemtype);
         self::deleteReservationItems($itemtype);
         //Remove datainjection specific file
         self::deleteInjectionFile($name);
         //Delete profile informations associated with this type
         PluginGenericobjectProfile::deleteTypeFromProfile($itemtype);
         self::deleteTicketAssignation($itemtype);
         //Remove associations to simcards with this type
         self::deleteSimcardAssignation($itemtype);
         //Remove existing datainjection models
         self::removeDataInjectionModels($itemtype);
         //Delete specific locale directory
         self::deleteLocales($name, $itemtype);
         self::deleteItemtypeReferencesInGLPI($itemtype);
         self::deleteItemTypeFilesAndClasses($name, $this->getTable(), $itemtype);
         //self::deleteNotepad($itemtype);
         if (preg_match("/PluginGenericobject(.*)/", $itemtype, $results)) {
             $newrightname = 'plugin_genericobject_' . strtolower($results[1]) . 's';
             ProfileRight::deleteProfileRights(array($newrightname));
         }
         $prof = new Profile();
         $profiles = getAllDatasFromTable('glpi_profiles');
         foreach ($profiles as $profile) {
             $helpdesk_item_types = json_decode($profile['helpdesk_item_type'], true);
             if ($helpdesk_item_types !== null) {
                 $index = array_search($itemtype, $helpdesk_item_types);
                 if ($index) {
                     unset($helpdesk_item_types[$index]);
                     $tmp['id'] = $profile['id'];
                     $tmp['helpdesk_item_type'] = json_encode($helpdesk_item_types);
                     $prof->update($tmp);
                 }
             }
         }
         return true;
     } else {
         return false;
     }
 }
示例#5
0
 static function uninstall()
 {
     global $DB;
     ProfileRight::deleteProfileRights(array(self::RIGHT_SIMCARD_SIMCARD));
     unset($_SESSION["glpiactiveprofile"][self::RIGHT_SIMCARD_SIMCARD]);
 }
示例#6
0
function plugin_example_uninstall()
{
    global $DB;
    $config = new Config();
    $config->deleteConfigurationValues('plugin:Example', array('configuration' => false));
    ProfileRight::deleteProfileRights(array('example:read'));
    $notif = new Notification();
    $options = array('itemtype' => 'Ticket', 'event' => 'plugin_example', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    // Old version tables
    if (TableExists("glpi_dropdown_plugin_example")) {
        $query = "DROP TABLE `glpi_dropdown_plugin_example`";
        $DB->query($query) or die("error deleting glpi_dropdown_plugin_example");
    }
    if (TableExists("glpi_plugin_example")) {
        $query = "DROP TABLE `glpi_plugin_example`";
        $DB->query($query) or die("error deleting glpi_plugin_example");
    }
    // Current version tables
    if (TableExists("glpi_plugin_example_example")) {
        $query = "DROP TABLE `glpi_plugin_example_example`";
        $DB->query($query) or die("error deleting glpi_plugin_example_example");
    }
    if (TableExists("glpi_plugin_example_dropdowns")) {
        $query = "DROP TABLE `glpi_plugin_example_dropdowns`;";
        $DB->query($query) or die("error deleting glpi_plugin_example_dropdowns");
    }
    if (TableExists("glpi_plugin_example_devicecameras")) {
        $query = "DROP TABLE `glpi_plugin_example_devicecameras`;";
        $DB->query($query) or die("error deleting glpi_plugin_example_devicecameras");
    }
    if (TableExists("glpi_plugin_example_items_devicecameras")) {
        $query = "DROP TABLE `glpi_plugin_example_items_devicecameras`;";
        $DB->query($query) or die("error deleting glpi_plugin_example_items_devicecameras");
    }
    return true;
}
 static function uninstallProfile()
 {
     $pfProfile = new self();
     $a_rights = $pfProfile->getAllRights();
     foreach ($a_rights as $data) {
         ProfileRight::deleteProfileRights(array($data['field']));
     }
 }