Fix rights

This commit is contained in:
Johan Cwiklinski 2017-05-19 15:51:36 +02:00 committed by Johan Cwiklinski
parent 46a15511a2
commit e8acb472eb
2 changed files with 6 additions and 6 deletions

View File

@ -36,10 +36,10 @@
// And to save it in the session // And to save it in the session
function plugin_change_profile_example() { function plugin_change_profile_example() {
// For example : same right of computer // For example : same right of computer
if (Session::haveRight('computer', 'w')) { if (Session::haveRight('computer', UPDATE)) {
$_SESSION["glpi_plugin_example_profile"] = array('example' => 'w'); $_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'); $_SESSION["glpi_plugin_example_profile"] = array('example' => 'r');
} else { } else {

View File

@ -56,28 +56,28 @@ class PluginExampleChild extends CommonDBChild {
// * $mustBeAttached: some CommonDBChild can be free, without any parent. // * $mustBeAttached: some CommonDBChild can be free, without any parent.
static function canCreate() { static function canCreate() {
return (Session::haveRight('internet', 'w') return (Session::haveRight('internet', UPDATE)
&& parent::canCreate()); && parent::canCreate());
} }
static function canView() { static function canView() {
return (Session::haveRight('internet', 'r') return (Session::haveRight('internet', READ)
&& parent::canView()); && parent::canView());
} }
static function canUpdate() { static function canUpdate() {
return (Session::haveRight('internet', 'w') return (Session::haveRight('internet', UPDATE)
&& parent::canUpdate()); && parent::canUpdate());
} }
static function canDelete() { static function canDelete() {
return (Session::haveRight('internet', 'w') return (Session::haveRight('internet', DELETE)
&& parent::canDelete()); && parent::canDelete());
} }