diff --git a/authzgroupsoo.php b/authzgroupsoo.php index c40c122..ffd0167 100644 --- a/authzgroupsoo.php +++ b/authzgroupsoo.php @@ -85,6 +85,7 @@ class authzgroupsoo { case "2": $res[$k] = "RW"; break; case "1": $res[$k] = "RO"; break; + case "0": $res[$k] = "NO"; break; default: throw new \Exception (dgettext ("domframework", "Unknown right stored"), 500); @@ -318,7 +319,7 @@ class authzgroupsoo "idright" => array ("integer", "not null", "autoincrement"), "idgroup" => array ("integer", "not null"), "idobject" => array ("integer", "not null"), - "right" => array ("varchar(2)", "not null"), // RO,RW + "right" => array ("varchar(2)", "not null"), // NO, RO,RW "comment" => array ("varchar(255)"))); $this->dbRight->primary ("idright"); $this->dbRight->unique (array ("idright", array ("idgroup","idobject"))); @@ -1037,9 +1038,12 @@ class authzgroupsoo { case "RW": $right=2;break; case "RO": $right=1;break; + // Normally, the NO is not used as the entry should be removed and the user + // will have the same result. The NO allow to force the value. + case "NO": $right=0;break; default: throw new \Exception (dgettext ("domframework", - "Unknown right provided (RO/RW only)"), + "Unknown right provided (NO/RO/RW only)"), 500); } $groups = $this->groupRead ($module, $group); @@ -1079,9 +1083,10 @@ class authzgroupsoo { case "2": $right=2;break; case "1": $right=1;break; + case "0": $right=0;break; default: throw new \Exception (dgettext ("domframework", - "Unknown right provided (RO/RW only)"), + "Unknown right provided (0/1/2 only)"), 500); } $groups = $this->groupReadByID ($module, $idgroup); @@ -1161,9 +1166,10 @@ class authzgroupsoo { case "RW": $newright=2;break; case "RO": $newright=1;break; + case "NO": $newright=0;break; default: throw new \Exception (dgettext ("domframework", - "Unknown right provided (RO/RW only)"), + "Unknown right provided (NO/RO/RW only)"), 500); } $idrights = $this->rightRead ($module, $group, $object); @@ -1196,9 +1202,10 @@ class authzgroupsoo { case "2": $newright=2;break; case "1": $newright=1;break; + case "0": $newright=0;break; default: throw new \Exception (dgettext ("domframework", - "Unknown right provided (RO/RW only)"), + "Unknown right provided (0/1/2 only)"), 500); } $idrights = $this->rightReadByID ($module, $idright); @@ -1336,7 +1343,7 @@ class authzgroupsoo */ public function rightTypes () { - return array ("1" => "RO", "2" => "RW"); + return array ("0" => "NO", "1" => "RO", "2" => "RW"); } /** Check if the provided data are compilant with the group specification