Change all the "new class" by "new Class"
This commit is contained in:
@@ -42,7 +42,7 @@ class Authzgroups
|
||||
if ($this->rightCache !== null)
|
||||
return $this->rightCache;
|
||||
if ($this->dbObject == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Object is not connected"), 500);
|
||||
// Do the SQL request in hard to be more performant on jointures
|
||||
if ($user === "cli" || $user === "root")
|
||||
@@ -74,7 +74,7 @@ class Authzgroups
|
||||
{
|
||||
if ($this->dbObject->debug) echo "DEBUG : PREPARE ERROR ! Return FALSE".
|
||||
$e->getMessage()."\n";
|
||||
throw new Exception ($e->getMessage(), 500);
|
||||
throw new \Exception ($e->getMessage(), 500);
|
||||
}
|
||||
|
||||
if ($user !== "cli" && $user !== "root")
|
||||
@@ -84,13 +84,13 @@ class Authzgroups
|
||||
{
|
||||
$rc = $st->execute ();
|
||||
if ($rc === false)
|
||||
throw new Exception ("Can't execute SQL request", 500);
|
||||
throw new \Exception ("Can't execute SQL request", 500);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
if ($this->dbObject->debug) echo "DEBUG : EXECUTE ERROR ! Return FALSE".
|
||||
$e->getMessage()."\n";
|
||||
throw new Exception ($e->getMessage(), 500);
|
||||
throw new \Exception ($e->getMessage(), 500);
|
||||
}
|
||||
$res = array ();
|
||||
while ($d = $st->fetch (PDO::FETCH_ASSOC))
|
||||
@@ -103,7 +103,7 @@ class Authzgroups
|
||||
case "2": $res[$k] = "RW"; break;
|
||||
case "1": $res[$k] = "RO"; break;
|
||||
default:
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Unknown right stored"), 500);
|
||||
}
|
||||
}
|
||||
@@ -156,16 +156,16 @@ class Authzgroups
|
||||
public function accessRight ($module, $user, $object)
|
||||
{
|
||||
if ($this->dbObject === null)
|
||||
throw new Exception ("Can't use authzgroups\\accessRight without ".
|
||||
throw new \Exception ("Can't use authzgroups\\accessRight without ".
|
||||
"connected database", 500);
|
||||
if ($module === null || ! is_string ($module) || trim ($module) === "")
|
||||
throw new Exception ("Module not provided to authzgroups\\accessRight",
|
||||
throw new \Exception ("Module not provided to authzgroups\\accessRight",
|
||||
500);
|
||||
if ($user === null || ! is_string ($user) || trim ($user) === "")
|
||||
throw new Exception ("User not provided to authzgroups\\accessright",
|
||||
throw new \Exception ("User not provided to authzgroups\\accessright",
|
||||
500);
|
||||
if ($object === null || ! is_string ($object))
|
||||
throw new Exception ("Object not provided to authzgroups\\accessRight",
|
||||
throw new \Exception ("Object not provided to authzgroups\\accessRight",
|
||||
500);
|
||||
if ($object{0} !== "/")
|
||||
$object = "/$object";
|
||||
@@ -176,9 +176,9 @@ class Authzgroups
|
||||
if ($rc !== "NO")
|
||||
return TRUE;
|
||||
if ($user === "anonymous")
|
||||
throw new Exception (dgettext ("domframework", "Anonymous not allowed"),
|
||||
throw new \Exception (dgettext ("domframework", "Anonymous not allowed"),
|
||||
401);
|
||||
throw new Exception (dgettext ("domframework", "Access forbidden"), 403);
|
||||
throw new \Exception (dgettext ("domframework", "Access forbidden"), 403);
|
||||
}
|
||||
|
||||
/** Return TRUE if the user right allow to edit the object (RW only)
|
||||
@@ -191,16 +191,16 @@ class Authzgroups
|
||||
public function accessWrite ($module, $user, $object)
|
||||
{
|
||||
if ($this->dbObject === null)
|
||||
throw new Exception ("Can't use authzgroups\\accessWrite without ".
|
||||
throw new \Exception ("Can't use authzgroups\\accessWrite without ".
|
||||
"connected database", 500);
|
||||
if ($module === null || ! is_string ($module) || trim ($module) === "")
|
||||
throw new Exception ("Module not provided to authzgroups\\accessWrite",
|
||||
throw new \Exception ("Module not provided to authzgroups\\accessWrite",
|
||||
500);
|
||||
if ($user === null || ! is_string ($user) || trim ($user) === "")
|
||||
throw new Exception ("User not provided to authzgroups\\accessWrite",
|
||||
throw new \Exception ("User not provided to authzgroups\\accessWrite",
|
||||
500);
|
||||
if ($object === null || ! is_string ($object))
|
||||
throw new Exception ("Object not provided to authzgroups\\accessWrite",
|
||||
throw new \Exception ("Object not provided to authzgroups\\accessWrite",
|
||||
500);
|
||||
if ($object{0} !== "/")
|
||||
$object = "/$object";
|
||||
@@ -211,9 +211,9 @@ class Authzgroups
|
||||
if ($rc === "RW")
|
||||
return TRUE;
|
||||
if ($user === "anonymous")
|
||||
throw new Exception (dgettext ("domframework", "Anonymous not allowed"),
|
||||
throw new \Exception (dgettext ("domframework", "Anonymous not allowed"),
|
||||
401);
|
||||
throw new Exception (dgettext ("domframework", "Modification forbidden"),
|
||||
throw new \Exception (dgettext ("domframework", "Modification forbidden"),
|
||||
403);
|
||||
}
|
||||
|
||||
@@ -228,16 +228,16 @@ class Authzgroups
|
||||
public function accessReadOnly ($module, $user, $object)
|
||||
{
|
||||
if ($this->dbObject === null)
|
||||
throw new Exception ("Can't use authzgroups\\accessReadOnly without ".
|
||||
throw new \Exception ("Can't use authzgroups\\accessReadOnly without ".
|
||||
"connected database", 500);
|
||||
if ($module === null || ! is_string ($module) || trim ($module) === "")
|
||||
throw new Exception ("Module not provided to authzgroups\\accessReadOnly",
|
||||
throw new \Exception ("Module not provided to authzgroups\\accessReadOnly",
|
||||
500);
|
||||
if ($user === null || ! is_string ($user) || trim ($user) === "")
|
||||
throw new Exception ("User not provided to authzgroups\\accessReadOnly",
|
||||
throw new \Exception ("User not provided to authzgroups\\accessReadOnly",
|
||||
500);
|
||||
if ($object === null || ! is_string ($object))
|
||||
throw new Exception ("Object not provided to authzgroups\\accessReadOnly",
|
||||
throw new \Exception ("Object not provided to authzgroups\\accessReadOnly",
|
||||
500);
|
||||
if ($object{0} !== "/")
|
||||
$object = "/$object";
|
||||
@@ -248,9 +248,9 @@ class Authzgroups
|
||||
if ($rc === "RO")
|
||||
return TRUE;
|
||||
if ($user === "anonymous")
|
||||
throw new Exception (dgettext ("domframework", "Anonymous not allowed"),
|
||||
throw new \Exception (dgettext ("domframework", "Anonymous not allowed"),
|
||||
401);
|
||||
throw new Exception (dgettext ("domframework", "Access forbidden"), 403);
|
||||
throw new \Exception (dgettext ("domframework", "Access forbidden"), 403);
|
||||
}
|
||||
|
||||
/////////////////////////
|
||||
@@ -267,7 +267,7 @@ class Authzgroups
|
||||
public function connect ($dsn, $username=null, $password=null,
|
||||
$driver_options=null)
|
||||
{
|
||||
$this->dbObject = new dblayer ($dsn, $username, $password, $driver_options);
|
||||
$this->dbObject = new Dblayer ($dsn, $username, $password, $driver_options);
|
||||
$this->dbObject->debug = $this->debug;
|
||||
$this->dbObject->table = "authzobject";
|
||||
$this->dbObject->prefix = $this->tableprefix;
|
||||
@@ -284,7 +284,7 @@ class Authzgroups
|
||||
"object" => dgettext ("domframework", "Object"),
|
||||
"comment" => dgettext ("domframework", "Comment"));
|
||||
|
||||
$this->dbGroup = new dblayer ($dsn, $username, $password, $driver_options);
|
||||
$this->dbGroup = new Dblayer ($dsn, $username, $password, $driver_options);
|
||||
$this->dbGroup->debug = $this->debug;
|
||||
$this->dbGroup->table = "authzgroup";
|
||||
$this->dbGroup->prefix = $this->tableprefix;
|
||||
@@ -301,7 +301,7 @@ class Authzgroups
|
||||
"group" => dgettext ("domframework", "Group"),
|
||||
"comment" => dgettext ("domframework", "Comment"));
|
||||
|
||||
$this->dbGroupMember = new dblayer ($dsn, $username, $password,
|
||||
$this->dbGroupMember = new Dblayer ($dsn, $username, $password,
|
||||
$driver_options);
|
||||
$this->dbGroupMember->debug = $this->debug;
|
||||
$this->dbGroupMember->table = "authzgroupmember";
|
||||
@@ -323,7 +323,7 @@ class Authzgroups
|
||||
"idgroup"=>dgettext ("domframework", "idgroup"),
|
||||
"comment"=>dgettext ("domframework", "Comment"));
|
||||
|
||||
$this->dbRight = new dblayer ($dsn, $username, $password, $driver_options);
|
||||
$this->dbRight = new Dblayer ($dsn, $username, $password, $driver_options);
|
||||
$this->dbRight->debug = $this->debug;
|
||||
$this->dbRight->table = "authzright";
|
||||
$this->dbRight->prefix = $this->tableprefix;
|
||||
@@ -362,17 +362,17 @@ class Authzgroups
|
||||
public function createTables ()
|
||||
{
|
||||
if ($this->dbObject == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Object is not connected"), 500);
|
||||
if ($this->dbGroup == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Group is not connected"), 500);
|
||||
if ($this->dbGroupMember == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for GroupMember is not connected"),
|
||||
500);
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
$tables = array ("Object", "Group", "GroupMember", "Right");
|
||||
foreach ($tables as $table)
|
||||
@@ -402,7 +402,7 @@ class Authzgroups
|
||||
public function objectAdd ($module, $object, $comment="")
|
||||
{
|
||||
if ($this->dbObject == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Object is not connected"), 500);
|
||||
// TODO : Check parameters before saving them
|
||||
$this->rightCache = null;
|
||||
@@ -418,11 +418,11 @@ class Authzgroups
|
||||
public function objectDel ($module, $object)
|
||||
{
|
||||
if ($this->dbObject == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Object is not connected"), 500);
|
||||
$idobjects = $this->objectRead ($module, $object);
|
||||
if (! isset ($idobjects[0]["idobject"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted object not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbObject->delete ($idobjects[0]["idobject"]);
|
||||
@@ -435,11 +435,11 @@ class Authzgroups
|
||||
public function objectDelByID ($module, $idobject)
|
||||
{
|
||||
if ($this->dbObject == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Object is not connected"), 500);
|
||||
$idobjects = $this->objectReadByID ($module, $idobject);
|
||||
if (! isset ($idobjects[0]["idobject"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted object not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbObject->delete ($idobjects[0]["idobject"]);
|
||||
@@ -454,11 +454,11 @@ class Authzgroups
|
||||
public function objectUpdate ($module, $object, $newobject, $newcomment="")
|
||||
{
|
||||
if ($this->dbObject == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Object is not connected"), 500);
|
||||
$idobjects = $this->objectRead ($module, $object);
|
||||
if (! isset ($idobjects[0]["idobject"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted object not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbObject->update ($idobjects[0]["idobject"],
|
||||
@@ -476,11 +476,11 @@ class Authzgroups
|
||||
$newcomment="")
|
||||
{
|
||||
if ($this->dbObject == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Object is not connected"), 500);
|
||||
$idobjects = $this->objectReadByID ($module, $idobject);
|
||||
if (! isset ($idobjects[0]["idobject"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted object not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbObject->update ($idobjects[0]["idobject"],
|
||||
@@ -496,7 +496,7 @@ class Authzgroups
|
||||
public function objectRead ($module, $object=null)
|
||||
{
|
||||
if ($this->dbObject == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Object is not connected"), 500);
|
||||
$select[] = array ("module", $module);
|
||||
if ($object !== null)
|
||||
@@ -513,7 +513,7 @@ class Authzgroups
|
||||
public function objectReadByID ($module, $idobject=null)
|
||||
{
|
||||
if ($this->dbObject == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Object is not connected"), 500);
|
||||
$select[] = array ("module", $module);
|
||||
if ($idobject !== null)
|
||||
@@ -551,7 +551,7 @@ class Authzgroups
|
||||
public function groupAdd ($module, $group, $comment="")
|
||||
{
|
||||
if ($this->dbGroup == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Group is not connected"), 500);
|
||||
// TODO : Check parameters before saving them
|
||||
return $this->dbGroup->insert (array ("module"=>$module,
|
||||
@@ -566,11 +566,11 @@ class Authzgroups
|
||||
public function groupDel ($module, $group)
|
||||
{
|
||||
if ($this->dbGroup == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Group is not connected"), 500);
|
||||
$idgroups = $this->groupRead ($module, $group);
|
||||
if (! isset ($idgroups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
return $this->dbGroup->delete ($idgroups[0]["idgroup"]);
|
||||
}
|
||||
@@ -582,11 +582,11 @@ class Authzgroups
|
||||
public function groupDelByID ($module, $idgroup)
|
||||
{
|
||||
if ($this->dbGroup == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Group is not connected"), 500);
|
||||
$idgroups = $this->groupReadByID ($module, $idgroup);
|
||||
if (! isset ($idgroups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
return $this->dbGroup->delete ($idgroups[0]["idgroup"]);
|
||||
}
|
||||
@@ -600,11 +600,11 @@ class Authzgroups
|
||||
public function groupUpdate ($module, $group, $newgroup, $comment="")
|
||||
{
|
||||
if ($this->dbGroup == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Group is not connected"), 500);
|
||||
$idgroups = $this->groupRead ($module, $group);
|
||||
if (! isset ($idgroups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
return $this->dbGroup->update ($idgroups[0]["idgroup"],
|
||||
array ("group"=>$newgroup,
|
||||
@@ -620,11 +620,11 @@ class Authzgroups
|
||||
public function groupUpdateByID ($module, $idgroup, $newgroup, $comment="")
|
||||
{
|
||||
if ($this->dbGroup == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Group is not connected"), 500);
|
||||
$idgroups = $this->groupReadByID ($module, $idgroup);
|
||||
if (! isset ($idgroups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
return $this->dbGroup->update ($idgroups[0]["idgroup"],
|
||||
array ("group"=>$newgroup,
|
||||
@@ -638,7 +638,7 @@ class Authzgroups
|
||||
public function groupRead ($module, $group=null)
|
||||
{
|
||||
if ($this->dbGroup == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Group is not connected"), 500);
|
||||
$select[] = array ("module", $module);
|
||||
if ($group !== null)
|
||||
@@ -654,7 +654,7 @@ class Authzgroups
|
||||
public function groupReadByID ($module, $idgroup)
|
||||
{
|
||||
if ($this->dbGroup == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Group is not connected"), 500);
|
||||
$select[] = array ("module", $module);
|
||||
$select[] = array ("idgroup", $idgroup);
|
||||
@@ -692,12 +692,12 @@ class Authzgroups
|
||||
public function groupmemberAdd ($module, $group, $user, $comment="")
|
||||
{
|
||||
if ($this->dbGroupMember == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for GroupMember is not connected"),
|
||||
500);
|
||||
$groups = $this->groupRead ($module, $group);
|
||||
if (! isset ($groups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbGroupMember->insert (array (
|
||||
@@ -714,18 +714,18 @@ class Authzgroups
|
||||
public function groupmemberDel ($module, $group, $user)
|
||||
{
|
||||
if ($this->dbGroupMember == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for GroupMember is not connected"),
|
||||
500);
|
||||
$groups = $this->groupRead ($module, $group);
|
||||
if (! isset ($groups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
$groupsMembers = $this->dbGroupMember->read (array (
|
||||
array ("user", $user),
|
||||
array ("idgroup", $groups[0]["idgroup"])));
|
||||
if (! isset ($groupsMembers[0]["idgroupmember"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted GroupMember not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbGroupMember->delete ($groupsMembers[0]["idgroupmember"]);
|
||||
@@ -739,17 +739,17 @@ class Authzgroups
|
||||
public function groupmemberDelByID ($module, $idgroup, $idgroupmember)
|
||||
{
|
||||
if ($this->dbGroupMember == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for GroupMember is not connected"), 500);
|
||||
$groups = $this->groupReadByID ($module, $idgroup);
|
||||
if (! isset ($groups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
$groupsMembers = $this->dbGroupMember->read (array (
|
||||
array ("idgroupmember", $idgroupmember),
|
||||
array ("idgroup", $idgroup)));
|
||||
if (! isset ($groupsMembers[0]["idgroupmember"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted GroupMember not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbGroupMember->delete ($groupsMembers[0]["idgroupmember"]);
|
||||
@@ -779,7 +779,7 @@ class Authzgroups
|
||||
{
|
||||
$data = $this->groupmemberReadUserDataByID ($module, $idgroup, $iduser);
|
||||
if (count ($data) === 0)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"IDUser in IDGroup not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbGroupMember->update ($iduser,
|
||||
@@ -795,7 +795,7 @@ class Authzgroups
|
||||
public function groupmemberReadUser ($module, $user)
|
||||
{
|
||||
if ($this->dbGroupMember == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for GroupMember is not connected"),
|
||||
500);
|
||||
$idgrouptmps = $this->groupRead ($module);
|
||||
@@ -821,7 +821,7 @@ class Authzgroups
|
||||
public function groupmemberReadUserByID ($module, $idgroupmember)
|
||||
{
|
||||
if ($this->dbGroupMember == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for GroupMember is not connected"),
|
||||
500);
|
||||
$idgrouptmps = $this->groupRead ($module);
|
||||
@@ -848,12 +848,12 @@ class Authzgroups
|
||||
public function groupmemberReadGroup ($module, $group)
|
||||
{
|
||||
if ($this->dbGroupMember == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for GroupMember is not connected"),
|
||||
500);
|
||||
$groups = $this->groupRead ($module, $group);
|
||||
if (! isset ($groups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
$select[] = array ("idgroup", $groups[0]["idgroup"]);
|
||||
return $this->dbGroupMember->read ($select, array ("user"));
|
||||
@@ -867,12 +867,12 @@ class Authzgroups
|
||||
public function groupmemberReadGroupByID ($module, $idgroup)
|
||||
{
|
||||
if ($this->dbGroupMember == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for GroupMember is not connected"),
|
||||
500);
|
||||
$groups = $this->groupReadByID ($module, $idgroup);
|
||||
if (! isset ($groups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
$select[] = array ("idgroup", $groups[0]["idgroup"]);
|
||||
return $this->dbGroupMember->read ($select);
|
||||
@@ -886,12 +886,12 @@ class Authzgroups
|
||||
public function groupmemberReadUserDataByID ($module, $idgroup, $iduser)
|
||||
{
|
||||
if ($this->dbGroupMember == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for GroupMember is not connected"),
|
||||
500);
|
||||
$groups = $this->groupReadByID ($module, $idgroup);
|
||||
if (! isset ($groups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
$select[] = array ("idgroup", $groups[0]["idgroup"]);
|
||||
$select[] = array ("idgroupmember", $iduser);
|
||||
@@ -930,24 +930,24 @@ class Authzgroups
|
||||
public function rightAdd ($module, $group, $object, $right, $comment="")
|
||||
{
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
switch ($right)
|
||||
{
|
||||
case "RW": $right=2;break;
|
||||
case "RO": $right=1;break;
|
||||
default:
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Unknown right provided (RO/RW only)"),
|
||||
500);
|
||||
}
|
||||
$groups = $this->groupRead ($module, $group);
|
||||
if (! isset ($groups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
$objects = $this->objectRead ($module, $object);
|
||||
if (! isset ($objects[0]["idobject"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted object not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbRight->insert (array ("idgroup"=>$groups[0]["idgroup"],
|
||||
@@ -968,24 +968,24 @@ class Authzgroups
|
||||
$comment="")
|
||||
{
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
switch ($idright)
|
||||
{
|
||||
case "2": $right=2;break;
|
||||
case "1": $right=1;break;
|
||||
default:
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Unknown right provided (RO/RW only)"),
|
||||
500);
|
||||
}
|
||||
$groups = $this->groupReadByID ($module, $idgroup);
|
||||
if (! isset ($groups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
$objects = $this->objectReadByID ($module, $idobject);
|
||||
if (! isset ($objects[0]["idobject"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted object not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbRight->insert (array ("idgroup"=>$groups[0]["idgroup"],
|
||||
@@ -1002,11 +1002,11 @@ class Authzgroups
|
||||
public function rightDel ($module, $group, $object)
|
||||
{
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
$idrights = $this->rightRead ($module, $group, $object);
|
||||
if (!isset ($idrights[0]["idright"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted right not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbRight->delete ($idrights[0]["idright"]);
|
||||
@@ -1019,11 +1019,11 @@ class Authzgroups
|
||||
public function rightDelByID ($module, $idright)
|
||||
{
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
$idrights = $this->rightReadByID ($module, $idright);
|
||||
if (!isset ($idrights[0]["idright"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted right not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbRight->delete ($idrights[0]["idright"]);
|
||||
@@ -1040,20 +1040,20 @@ class Authzgroups
|
||||
$newcomment="")
|
||||
{
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
switch ($newright)
|
||||
{
|
||||
case "RW": $newright=2;break;
|
||||
case "RO": $newright=1;break;
|
||||
default:
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Unknown right provided (RO/RW only)"),
|
||||
500);
|
||||
}
|
||||
$idrights = $this->rightRead ($module, $group, $object);
|
||||
if (!isset ($idrights[0]["idright"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted right not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbRight->update ($idrights[0]["idright"],
|
||||
@@ -1072,20 +1072,20 @@ class Authzgroups
|
||||
$newcomment="")
|
||||
{
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
switch ($newright)
|
||||
{
|
||||
case "2": $newright=2;break;
|
||||
case "1": $newright=1;break;
|
||||
default:
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Unknown right provided (RO/RW only)"),
|
||||
500);
|
||||
}
|
||||
$idrights = $this->rightReadByID ($module, $idright);
|
||||
if (!isset ($idrights[0]["idright"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted right not found"), 404);
|
||||
$this->rightCache = null;
|
||||
return $this->dbRight->update ($idrights[0]["idright"],
|
||||
@@ -1104,15 +1104,15 @@ class Authzgroups
|
||||
public function rightRead ($module, $group, $object)
|
||||
{
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
$groups = $this->groupRead ($module, $group);
|
||||
if (! isset ($groups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
$objects = $this->objectRead ($module, $object);
|
||||
if (! isset ($objects[0]["idobject"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted object not found"), 404);
|
||||
$select[] = array ("idgroup", $groups[0]["idgroup"]);
|
||||
$select[] = array ("idobject", $objects[0]["idobject"]);
|
||||
@@ -1126,11 +1126,11 @@ class Authzgroups
|
||||
public function rightReadByGroup ($module, $group)
|
||||
{
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
$groups = $this->groupRead ($module, $group);
|
||||
if (! isset ($groups[0]["idgroup"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted group not found"), 404);
|
||||
return $this->rightReadByGroupByID ($module, $objects[0]["idgroup"]);
|
||||
}
|
||||
@@ -1142,7 +1142,7 @@ class Authzgroups
|
||||
public function rightReadByGroupByID ($module, $idgroup)
|
||||
{
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
$select[] = array ("idgroup", $idgroup);
|
||||
return $this->dbRight->read ($select);
|
||||
@@ -1156,7 +1156,7 @@ class Authzgroups
|
||||
public function rightReadByID ($module, $idright)
|
||||
{
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
$select[] = array ("idright", $idright);
|
||||
return $this->dbRight->read ($select);
|
||||
@@ -1169,11 +1169,11 @@ class Authzgroups
|
||||
public function rightReadByObject ($module, $object)
|
||||
{
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
$objects = $this->objectRead ($module, $object);
|
||||
if (! isset ($objects[0]["idobject"]))
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"Wanted object not found"), 404);
|
||||
$select[] = array ("idobject", $objects[0]["idobject"]);
|
||||
return $this->dbRight->read ($select);
|
||||
@@ -1186,7 +1186,7 @@ class Authzgroups
|
||||
public function rightReadByObjectByID ($module, $idobject)
|
||||
{
|
||||
if ($this->dbRight == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
throw new \Exception (dgettext ("domframework",
|
||||
"DB for Right is not connected"), 500);
|
||||
// FIXME : Do not use $module ?
|
||||
$select[] = array ("idobject", $idobject);
|
||||
|
||||
Reference in New Issue
Block a user