authzgroupsoo : allow to set the right to NO. It can be different of not set
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4953 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -85,6 +85,7 @@ class authzgroupsoo
|
|||||||
{
|
{
|
||||||
case "2": $res[$k] = "RW"; break;
|
case "2": $res[$k] = "RW"; break;
|
||||||
case "1": $res[$k] = "RO"; break;
|
case "1": $res[$k] = "RO"; break;
|
||||||
|
case "0": $res[$k] = "NO"; break;
|
||||||
default:
|
default:
|
||||||
throw new \Exception (dgettext ("domframework",
|
throw new \Exception (dgettext ("domframework",
|
||||||
"Unknown right stored"), 500);
|
"Unknown right stored"), 500);
|
||||||
@@ -318,7 +319,7 @@ class authzgroupsoo
|
|||||||
"idright" => array ("integer", "not null", "autoincrement"),
|
"idright" => array ("integer", "not null", "autoincrement"),
|
||||||
"idgroup" => array ("integer", "not null"),
|
"idgroup" => array ("integer", "not null"),
|
||||||
"idobject" => 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)")));
|
"comment" => array ("varchar(255)")));
|
||||||
$this->dbRight->primary ("idright");
|
$this->dbRight->primary ("idright");
|
||||||
$this->dbRight->unique (array ("idright", array ("idgroup","idobject")));
|
$this->dbRight->unique (array ("idright", array ("idgroup","idobject")));
|
||||||
@@ -1037,9 +1038,12 @@ class authzgroupsoo
|
|||||||
{
|
{
|
||||||
case "RW": $right=2;break;
|
case "RW": $right=2;break;
|
||||||
case "RO": $right=1;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:
|
default:
|
||||||
throw new \Exception (dgettext ("domframework",
|
throw new \Exception (dgettext ("domframework",
|
||||||
"Unknown right provided (RO/RW only)"),
|
"Unknown right provided (NO/RO/RW only)"),
|
||||||
500);
|
500);
|
||||||
}
|
}
|
||||||
$groups = $this->groupRead ($module, $group);
|
$groups = $this->groupRead ($module, $group);
|
||||||
@@ -1079,9 +1083,10 @@ class authzgroupsoo
|
|||||||
{
|
{
|
||||||
case "2": $right=2;break;
|
case "2": $right=2;break;
|
||||||
case "1": $right=1;break;
|
case "1": $right=1;break;
|
||||||
|
case "0": $right=0;break;
|
||||||
default:
|
default:
|
||||||
throw new \Exception (dgettext ("domframework",
|
throw new \Exception (dgettext ("domframework",
|
||||||
"Unknown right provided (RO/RW only)"),
|
"Unknown right provided (0/1/2 only)"),
|
||||||
500);
|
500);
|
||||||
}
|
}
|
||||||
$groups = $this->groupReadByID ($module, $idgroup);
|
$groups = $this->groupReadByID ($module, $idgroup);
|
||||||
@@ -1161,9 +1166,10 @@ class authzgroupsoo
|
|||||||
{
|
{
|
||||||
case "RW": $newright=2;break;
|
case "RW": $newright=2;break;
|
||||||
case "RO": $newright=1;break;
|
case "RO": $newright=1;break;
|
||||||
|
case "NO": $newright=0;break;
|
||||||
default:
|
default:
|
||||||
throw new \Exception (dgettext ("domframework",
|
throw new \Exception (dgettext ("domframework",
|
||||||
"Unknown right provided (RO/RW only)"),
|
"Unknown right provided (NO/RO/RW only)"),
|
||||||
500);
|
500);
|
||||||
}
|
}
|
||||||
$idrights = $this->rightRead ($module, $group, $object);
|
$idrights = $this->rightRead ($module, $group, $object);
|
||||||
@@ -1196,9 +1202,10 @@ class authzgroupsoo
|
|||||||
{
|
{
|
||||||
case "2": $newright=2;break;
|
case "2": $newright=2;break;
|
||||||
case "1": $newright=1;break;
|
case "1": $newright=1;break;
|
||||||
|
case "0": $newright=0;break;
|
||||||
default:
|
default:
|
||||||
throw new \Exception (dgettext ("domframework",
|
throw new \Exception (dgettext ("domframework",
|
||||||
"Unknown right provided (RO/RW only)"),
|
"Unknown right provided (0/1/2 only)"),
|
||||||
500);
|
500);
|
||||||
}
|
}
|
||||||
$idrights = $this->rightReadByID ($module, $idright);
|
$idrights = $this->rightReadByID ($module, $idright);
|
||||||
@@ -1336,7 +1343,7 @@ class authzgroupsoo
|
|||||||
*/
|
*/
|
||||||
public function rightTypes ()
|
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
|
/** Check if the provided data are compilant with the group specification
|
||||||
|
|||||||
Reference in New Issue
Block a user