function plugin_addressing_uninstall()
{
    global $DB;
    include_once GLPI_ROOT . "/plugins/addressing/inc/profile.class.php";
    include_once GLPI_ROOT . "/plugins/addressing/inc/menu.class.php";
    $migration = new Migration("2.2.0");
    $tables = array("glpi_plugin_addressing_addressings", "glpi_plugin_addressing_configs");
    foreach ($tables as $table) {
        $migration->dropTable($table);
    }
    $itemtypes = array('DisplayPreference', 'Bookmark');
    foreach ($itemtypes as $itemtype) {
        $item = new $itemtype();
        $item->deleteByCriteria(array('itemtype' => 'PluginAddressingAddressing'));
    }
    //Delete rights associated with the plugin
    $profileRight = new ProfileRight();
    foreach (PluginAddressingProfile::getAllRights() as $right) {
        $profileRight->deleteByCriteria(array('name' => $right['field']));
    }
    //Remove rigth from $_SESSION['glpiactiveprofile'] if exists
    PluginAddressingProfile::removeRightsFromSession();
    PluginAddressingMenu::removeRightsFromSession();
    return true;
}
Example #2
0
function plugin_addressing_MassiveActionsProcess($data)
{
    $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
    switch ($data['action']) {
        case 'plugin_addressing_allow':
            if ($data['itemtype'] == 'Profile') {
                $profglpi = new Profile();
                $prof = new PluginAddressingProfile();
                foreach ($data["item"] as $key => $val) {
                    if ($profglpi->getFromDB($key) && $profglpi->fields['interface'] != 'helpdesk') {
                        if ($prof->getFromDBByProfile($key)) {
                            if ($prof->update(array('id' => $prof->fields['id'], 'profiles_id' => $key, 'addressing' => $data['use']))) {
                                $res['ok']++;
                            } else {
                                $res['ko']++;
                            }
                        } else {
                            if ($prof->add(array('id' => $prof->fields['id'], 'profiles_id' => $key, 'addressing' => $data['use']))) {
                                $res['ok']++;
                            } else {
                                $res['ko']++;
                            }
                        }
                    } else {
                        $res['ko']++;
                    }
                }
            }
            break;
    }
    return $res;
}
Example #3
0
Copyright (C) 2003-2011 by the addressing Development Team.

https://forge.indepnet.net/projects/addressing
-------------------------------------------------------------------------

LICENSE

This file is part of addressing.

Addressing is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Addressing is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Addressing. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Session::checkRight("profile", "r");
$prof = new PluginAddressingProfile();
//Save profile
if (isset($_POST['update'])) {
    $prof->update($_POST);
    Html::back();
}