From 2a145e4db407e07f5760101f8d77620e7742f41c Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 17 Aug 2015 14:32:10 +0000 Subject: [PATCH] authzgroups : remove a / if it is alone. Permit to check if the rights on / object is available git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2257 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- authzgroups.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/authzgroups.php b/authzgroups.php index d5460ba..3a2c574 100644 --- a/authzgroups.php +++ b/authzgroups.php @@ -120,7 +120,7 @@ class authzgroups return $ressource[$object]; } - /** Return TRUE if the user right allow to see the object + /** Return TRUE if the user right allow to see the object (RO or RW) Return a 403 Exception if the user don't have the right Return a 401 Exception if the user is not connected */ public function accessRight ($module, $user, $object) @@ -137,6 +137,7 @@ class authzgroups if ($object === null || ! is_string ($object)) throw new Exception ("Object not provided to authzgroups\\accessRight", 500); + if ($object === "/") $object = ""; $rc = $this->allow ($module, $user, "/$object"); trigger_error ("authzgroups : accessRight ('$module','$user','/$object')". "=$rc", E_USER_NOTICE); @@ -147,7 +148,7 @@ class authzgroups throw new Exception (_("Access forbidden"), 403); } - /** Return TRUE if the user right allow to edit the object + /** Return TRUE if the user right allow to edit the object (RW only) Return a 403 Exception if the user don't have the right Return a 401 Exception if the user is not connected */ public function accessWrite ($module, $user, $object) @@ -164,6 +165,7 @@ class authzgroups if ($object === null || ! is_string ($object)) throw new Exception ("Object not provided to authzgroups\\accessWrite", 500); + if ($object === "/") $object = ""; $rc = $this->allow ($module, $user, "/$object"); trigger_error ("authzgroups : accessWrite ('$module','$user','/$object')". "=$rc", E_USER_NOTICE); @@ -175,7 +177,7 @@ class authzgroups } /** Return TRUE if the user right allow to see but without modification - the object + the object (RO only) Return a 403 Exception if the user don't have the right Return a 401 Exception if the user is not connected */ public function accessReadOnly ($module, $user, $object) @@ -192,6 +194,7 @@ class authzgroups if ($object === null || ! is_string ($object)) throw new Exception ("Object not provided to authzgroups\\accessReadOnly", 500); + if ($object === "/") $object = ""; $rc = $this->allow ($module, $user, "/$object"); trigger_error ("authzgroups : accessReadOnly ('$module','$user','/$object')" ."=$rc", E_USER_NOTICE);