diff --git a/hook.php b/hook.php index f234bec..bbc196d 100644 --- a/hook.php +++ b/hook.php @@ -36,10 +36,10 @@ // And to save it in the session function plugin_change_profile_example() { // For example : same right of computer - if (Session::haveRight('computer', 'w')) { + if (Session::haveRight('computer', UPDATE)) { $_SESSION["glpi_plugin_example_profile"] = array('example' => 'w'); - } else if (Session::haveRight('computer', 'r')) { + } else if (Session::haveRight('computer', READ)) { $_SESSION["glpi_plugin_example_profile"] = array('example' => 'r'); } else { diff --git a/inc/child.class.php b/inc/child.class.php index 3ed3701..37ac675 100644 --- a/inc/child.class.php +++ b/inc/child.class.php @@ -56,28 +56,28 @@ class PluginExampleChild extends CommonDBChild { // * $mustBeAttached: some CommonDBChild can be free, without any parent. static function canCreate() { - return (Session::haveRight('internet', 'w') + return (Session::haveRight('internet', UPDATE) && parent::canCreate()); } static function canView() { - return (Session::haveRight('internet', 'r') + return (Session::haveRight('internet', READ) && parent::canView()); } static function canUpdate() { - return (Session::haveRight('internet', 'w') + return (Session::haveRight('internet', UPDATE) && parent::canUpdate()); } static function canDelete() { - return (Session::haveRight('internet', 'w') + return (Session::haveRight('internet', DELETE) && parent::canDelete()); }