authzgroups : add ByID in object Del/update support
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1871 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -246,6 +246,19 @@ class authzgroups
|
||||
return $this->dbObject->delete ($idobjects[0]["idobject"]);
|
||||
}
|
||||
|
||||
/** Remove an object from database and all the rights using it */
|
||||
public function objectDelByID ($module, $idobject)
|
||||
{
|
||||
if ($this->dbObject == null)
|
||||
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",
|
||||
"Wanted object not found"), 404);
|
||||
return $this->dbObject->delete ($idobjects[0]["idobject"]);
|
||||
}
|
||||
|
||||
/** Update an object in the database */
|
||||
public function objectUpdate ($module, $object, $newobject, $newcomment="")
|
||||
{
|
||||
@@ -261,6 +274,22 @@ class authzgroups
|
||||
"comment"=>$newcomment));
|
||||
}
|
||||
|
||||
/** Update an object in the database */
|
||||
public function objectUpdateByID ($module, $idobject, $newobject,
|
||||
$newcomment="")
|
||||
{
|
||||
if ($this->dbObject == null)
|
||||
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",
|
||||
"Wanted object not found"), 404);
|
||||
return $this->dbObject->update ($idobjects[0]["idobject"],
|
||||
array ("object"=>$newobject,
|
||||
"comment"=>$newcomment));
|
||||
}
|
||||
|
||||
/** Return an array with all the available objects in the module, or only
|
||||
one object if $object is provided */
|
||||
public function objectRead ($module, $object=null)
|
||||
@@ -274,6 +303,19 @@ class authzgroups
|
||||
return $this->dbObject->read ($select);
|
||||
}
|
||||
|
||||
/** Return an array with all the available objects in the module, or only
|
||||
one object if $object is provided */
|
||||
public function objectReadByID ($module, $idobject=null)
|
||||
{
|
||||
if ($this->dbObject == null)
|
||||
throw new Exception (dgettext ("domframework",
|
||||
"DB for Object is not connected"), 500);
|
||||
$select[] = array ("module", $module);
|
||||
if ($idobject !== null)
|
||||
$select[] = array ("idobject", $idobject);
|
||||
return $this->dbObject->read ($select);
|
||||
}
|
||||
|
||||
/** Return an array containing the titles of the table translating in the user
|
||||
language */
|
||||
public function objectTitles ()
|
||||
|
||||
Reference in New Issue
Block a user