domci : commas should be followed by space
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5281 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
112
authzgroups.php
112
authzgroups.php
@@ -169,8 +169,8 @@ class authzgroups
|
||||
$object = "/$object";
|
||||
$rc = $this->allow ($module, $user, "$object");
|
||||
if ($this->debug)
|
||||
trigger_error ("authzgroups : accessRight ('$module','$user','$object')".
|
||||
"=$rc", E_USER_NOTICE);
|
||||
trigger_error ("authzgroups : accessRight ('$module', '$user', ".
|
||||
"'$object')=$rc", E_USER_NOTICE);
|
||||
if ($rc !== "NO")
|
||||
return TRUE;
|
||||
if ($user === "anonymous")
|
||||
@@ -204,8 +204,8 @@ class authzgroups
|
||||
$object = "/$object";
|
||||
$rc = $this->allow ($module, $user, $object);
|
||||
if ($this->debug)
|
||||
trigger_error ("authzgroups : accessWrite ('$module','$user','$object')".
|
||||
"=$rc", E_USER_NOTICE);
|
||||
trigger_error ("authzgroups : accessWrite ('$module', '$user', ".
|
||||
"'$object')=$rc", E_USER_NOTICE);
|
||||
if ($rc === "RW")
|
||||
return TRUE;
|
||||
if ($user === "anonymous")
|
||||
@@ -241,7 +241,7 @@ class authzgroups
|
||||
$object = "/$object";
|
||||
$rc = $this->allow ($module, $user, $object);
|
||||
if ($this->debug)
|
||||
trigger_error ("authzgroups : accessReadOnly ('$module','$user',".
|
||||
trigger_error ("authzgroups : accessReadOnly ('$module', '$user', ".
|
||||
"'$object')" ."=$rc", E_USER_NOTICE);
|
||||
if ($rc === "RO")
|
||||
return TRUE;
|
||||
@@ -270,40 +270,34 @@ class authzgroups
|
||||
$this->dbObject->table = "authzobject";
|
||||
$this->dbObject->prefix = $this->tableprefix;
|
||||
$this->dbObject->fields = array (
|
||||
"idobject"=>array ("integer", "not null", "autoincrement"),
|
||||
"module"=> array ("varchar", "255", "not null"),
|
||||
"object"=> array ("varchar", "255", "not null"),
|
||||
"comment"=> array ("varchar", "255"));
|
||||
"idobject" => array ("integer", "not null", "autoincrement"),
|
||||
"module" => array ("varchar", "255", "not null"),
|
||||
"object" => array ("varchar", "255", "not null"),
|
||||
"comment" => array ("varchar", "255"));
|
||||
$this->dbObject->primary = "idobject";
|
||||
$this->dbObject->unique = array ("idobject", array ("object", "module"));
|
||||
$this->dbObject->titles = array ("idobject"=>dgettext ("domframework",
|
||||
"idobject"),
|
||||
"module"=>dgettext ("domframework",
|
||||
"Module"),
|
||||
"object"=>dgettext ("domframework",
|
||||
"Object"),
|
||||
"comment"=>dgettext ("domframework",
|
||||
"Comment"));
|
||||
$this->dbObject->titles = array (
|
||||
"idobject" => dgettext ("domframework", "idobject"),
|
||||
"module" => dgettext ("domframework", "Module"),
|
||||
"object" => dgettext ("domframework", "Object"),
|
||||
"comment" => dgettext ("domframework", "Comment"));
|
||||
|
||||
$this->dbGroup = new dblayer ($dsn, $username, $password, $driver_options);
|
||||
$this->dbGroup->debug = $this->debug;
|
||||
$this->dbGroup->table = "authzgroup";
|
||||
$this->dbGroup->prefix = $this->tableprefix;
|
||||
$this->dbGroup->fields = array (
|
||||
"idgroup"=>array ("integer", "not null", "autoincrement"),
|
||||
"module"=> array ("varchar", "255", "not null"),
|
||||
"group"=> array ("varchar", "255", "not null"),
|
||||
"comment"=>array ("varchar", "255"));
|
||||
"idgroup" => array ("integer", "not null", "autoincrement"),
|
||||
"module" => array ("varchar", "255", "not null"),
|
||||
"group" => array ("varchar", "255", "not null"),
|
||||
"comment" => array ("varchar", "255"));
|
||||
$this->dbGroup->primary = "idgroup";
|
||||
$this->dbGroup->unique = array ("idgroup", array ("module","group"));
|
||||
$this->dbGroup->titles = array ("idgroup"=>dgettext ("domframework",
|
||||
"idgroup"),
|
||||
"module"=>dgettext ("domframework",
|
||||
"Module"),
|
||||
"group"=>dgettext ("domframework",
|
||||
"Group"),
|
||||
"comment"=>dgettext ("domframework",
|
||||
"Comment"));
|
||||
$this->dbGroup->unique = array ("idgroup", array ("module", "group"));
|
||||
$this->dbGroup->titles = array (
|
||||
"idgroup" => dgettext ("domframework", "idgroup"),
|
||||
"module" => dgettext ("domframework", "Module"),
|
||||
"group" => dgettext ("domframework", "Group"),
|
||||
"comment" => dgettext ("domframework", "Comment"));
|
||||
|
||||
$this->dbGroupMember = new dblayer ($dsn, $username, $password,
|
||||
$driver_options);
|
||||
@@ -311,15 +305,15 @@ class authzgroups
|
||||
$this->dbGroupMember->table = "authzgroupmember";
|
||||
$this->dbGroupMember->prefix = $this->tableprefix;
|
||||
$this->dbGroupMember->fields = array (
|
||||
"idgroupmember"=>array ("integer", "not null", "autoincrement"),
|
||||
"user"=> array ("varchar", "255", "not null"),
|
||||
"idgroup"=> array ("integer", "not null"),
|
||||
"comment"=> array ("varchar", "255"));
|
||||
"idgroupmember" => array ("integer", "not null", "autoincrement"),
|
||||
"user" => array ("varchar", "255", "not null"),
|
||||
"idgroup" => array ("integer", "not null"),
|
||||
"comment" => array ("varchar", "255"));
|
||||
$this->dbGroupMember->primary = "idgroupmember";
|
||||
$this->dbGroupMember->unique = array ("idgroupmember",
|
||||
array ("user","idgroup"));
|
||||
array ("user", "idgroup"));
|
||||
$this->dbGroupMember->foreign = array (
|
||||
"idgroup"=>array ("authzgroup", "idgroup",
|
||||
"idgroup" => array ("authzgroup", "idgroup",
|
||||
"ON UPDATE CASCADE ON DELETE CASCADE"));
|
||||
$this->dbGroupMember->titles = array (
|
||||
"idgroupmember"=> dgettext ("domframework", "idgroupmember"),
|
||||
@@ -335,22 +329,22 @@ class authzgroups
|
||||
"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"), // RO, RW
|
||||
"comment"=> array ("varchar", "255"));
|
||||
$this->dbRight->primary = "idright";
|
||||
$this->dbRight->unique = array ("idright", array ("idgroup","idobject"));
|
||||
$this->dbRight->unique = array ("idright", array ("idgroup", "idobject"));
|
||||
$this->dbRight->foreign = array (
|
||||
"idgroup"=> array ("authzgroup", "idgroup",
|
||||
"ON UPDATE CASCADE ON DELETE CASCADE"),
|
||||
"idobject"=>array ("authzobject", "idobject",
|
||||
"ON UPDATE CASCADE ON DELETE CASCADE"),
|
||||
"idgroup" => array ("authzgroup", "idgroup",
|
||||
"ON UPDATE CASCADE ON DELETE CASCADE"),
|
||||
"idobject" => array ("authzobject", "idobject",
|
||||
"ON UPDATE CASCADE ON DELETE CASCADE"),
|
||||
);
|
||||
$this->dbRight->titles = array (
|
||||
"idright"=>dgettext ("domframework", "idright"),
|
||||
"idgroup"=>dgettext ("domframework", "idgroup"),
|
||||
"idobject"=>dgettext ("domframework", "idobject"),
|
||||
"right"=>dgettext ("domframework", "Right"),
|
||||
"comment"=>dgettext ("domframework", "Comment"));
|
||||
"idright" => dgettext ("domframework", "idright"),
|
||||
"idgroup" => dgettext ("domframework", "idgroup"),
|
||||
"idobject" => dgettext ("domframework", "idobject"),
|
||||
"right" => dgettext ("domframework", "Right"),
|
||||
"comment" => dgettext ("domframework", "Comment"));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -505,7 +499,8 @@ class authzgroups
|
||||
$select[] = array ("module", $module);
|
||||
if ($object !== null)
|
||||
$select[] = array ("object", $object);
|
||||
return $this->dbObject->read ($select, null, array(array("object","ASC")));
|
||||
return $this->dbObject->read ($select, null,
|
||||
array (array ("object", "ASC")));
|
||||
}
|
||||
|
||||
/** Return an array with all the available objects in the module, or only
|
||||
@@ -517,7 +512,7 @@ class authzgroups
|
||||
{
|
||||
if ($this->dbObject == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
"DB for Object is not connected"), 500);
|
||||
"DB for Object is not connected"), 500);
|
||||
$select[] = array ("module", $module);
|
||||
if ($idobject !== null)
|
||||
$select[] = array ("idobject", $idobject);
|
||||
@@ -725,11 +720,11 @@ class authzgroups
|
||||
throw new Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
$groupsMembers = $this->dbGroupMember->read (array (
|
||||
array ("user",$user),
|
||||
array ("idgroup",$groups[0]["idgroup"])));
|
||||
array ("user", $user),
|
||||
array ("idgroup", $groups[0]["idgroup"])));
|
||||
if (! isset ($groupsMembers[0]["idgroupmember"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
"Wanted GroupMember not found"), 404);
|
||||
"Wanted GroupMember not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbGroupMember->delete ($groupsMembers[0]["idgroupmember"]);
|
||||
}
|
||||
@@ -743,15 +738,14 @@ class authzgroups
|
||||
{
|
||||
if ($this->dbGroupMember == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
"DB for GroupMember is not connected"),
|
||||
500);
|
||||
"DB for GroupMember is not connected"), 500);
|
||||
$groups = $this->groupReadByID ($module, $idgroup);
|
||||
if (! isset ($groups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
"Wanted group not found"), 404);
|
||||
$groupsMembers = $this->dbGroupMember->read (array (
|
||||
array ("idgroupmember",$idgroupmember),
|
||||
array ("idgroup",$idgroup)));
|
||||
array ("idgroupmember", $idgroupmember),
|
||||
array ("idgroup", $idgroup)));
|
||||
if (! isset ($groupsMembers[0]["idgroupmember"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
"Wanted GroupMember not found"), 404);
|
||||
@@ -1118,8 +1112,8 @@ class authzgroups
|
||||
if (! isset ($objects[0]["idobject"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
"Wanted object not found"), 404);
|
||||
$select[] = array ("idgroup",$groups[0]["idgroup"]);
|
||||
$select[] = array ("idobject",$objects[0]["idobject"]);
|
||||
$select[] = array ("idgroup", $groups[0]["idgroup"]);
|
||||
$select[] = array ("idobject", $objects[0]["idobject"]);
|
||||
return $this->dbRight->read ($select);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user