Project

General

Profile

Revision cf9d65ba

IDcf9d65ba1f069d8a212ca6d0971c8891c73a0d71
Parent 77f0ba6f
Child b58488b5

Added by Francois POIROTTE about 7 years ago

Ajout gestion des permissions pour le plugin

L'utilisation du plugin (pour la partie déploiement) nécessite désormais
de disposer de la permission "UPDATE" sur la configuration dans GLPI.

Change-Id: Ia9c7fd4861a6636b5ce0375052b6f99a1145f9dc
Reviewed-on: https://vigilo-dev.si.c-s.fr/review/2405
Tested-by: Build system <>
Reviewed-by: Francois POIROTTE <>

View differences:

src/plugins/vigilo/front/menu.php
6 6
    DIRECTORY_SEPARATOR . "includes.php"
7 7
);
8 8

  
9
if (PluginVigiloMenu::canView()) {
10
    Html::header(
11
        __('Vigilo', 'vigilo'),
12
        $_SERVER["PHP_SELF"],
13
        "plugins",
14
        "PluginVigiloMenu",
15
        "menu"
9
Session::checkRight("config", UPDATE);
10

  
11
Html::header(
12
    __('Vigilo', 'vigilo'),
13
    $_SERVER["PHP_SELF"],
14
    "plugins",
15
    "PluginVigiloMenu",
16
    "menu"
17
);
18

  
19
$res = null;
20
$pipes = array();
21

  
22
if (!empty($_POST["deploy"])) {
23
    $fds = array(
24
        1 => array("pipe", "w"),
25
        2 => array("pipe", "w"),
26
    );
27

  
28
    $debug  = empty($_POST['debug']) ? '' : '--debug';
29
    $force  = empty($_POST['force']) ? '' : '--force';
30
    $cmd    = "/usr/bin/sudo -n /usr/bin/vigiconf deploy $force $debug";
31
    $env    = array(
32
        "LC_ALL" => isset($_SESSION["glpilanguage"]) ? $_SESSION["glpilanguage"] : "en",
33
        "PATH" => getenv("PATH")
16 34
    );
35
    $res    = proc_open($cmd, $fds, $pipes, NULL, $env);
17 36

  
18
    $res = null;
19
    $pipes = array();
20

  
21
    if (!empty($_POST["deploy"])) {
22
        $fds = array(
23
            1 => array("pipe", "w"),
24
            2 => array("pipe", "w"),
25
        );
26

  
27
        $debug  = empty($_POST['debug']) ? '' : '--debug';
28
        $force  = empty($_POST['force']) ? '' : '--force';
29
        $cmd    = "/usr/bin/sudo -n /usr/bin/vigiconf deploy $force $debug";
30
        $env    = array(
31
            "LC_ALL" => isset($_SESSION["glpilanguage"]) ? $_SESSION["glpilanguage"] : "en",
32
            "PATH" => getenv("PATH")
33
        );
34
        $res    = proc_open($cmd, $fds, $pipes, NULL, $env);
35

  
36
        if (!is_resource($res)) {
37
            $res = false;
38
        }
37
    if (!is_resource($res)) {
38
        $res = false;
39 39
    }
40
    PluginVigiloMenu::displayMenu($res, $pipes);
41
} else {
42
    Html::displayRightError();
43 40
}
41
PluginVigiloMenu::displayMenu($res, $pipes);
44 42

  
45 43
Html::footer();
src/plugins/vigilo/inc/menu.class.php
16 16

  
17 17
    public static function canView()
18 18
    {
19
        return true;
19
        return Session::haveRight("config", UPDATE);
20 20
    }
21 21

  
22 22
    public static function canCreate()

Also available in: Unified diff