authorisationdb : remove all the sub-objects when removing one object

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1475 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-06-20 11:53:48 +00:00
parent f1ca57b4cb
commit b30d0c9ec6

View File

@@ -188,7 +188,7 @@ class authorizationdb extends authorization
return TRUE; return TRUE;
} }
/** Remove the informations about an object /** Remove the informations about an object and all its sub-objects
@param string $object Object path to drop @param string $object Object path to drop
@return TRUE or an exception with the error message */ @return TRUE or an exception with the error message */
public function drop ($object) public function drop ($object)
@@ -229,6 +229,7 @@ class authorizationdb extends authorization
throw new Exception (_("Removing more than one object"), 412); throw new Exception (_("Removing more than one object"), 412);
if ($rc == 0) if ($rc == 0)
throw new Exception (_("No object removed"), 412); throw new Exception (_("No object removed"), 412);
$rc = $this->db->delete ("$object$this->separator%");
return TRUE; return TRUE;
} }
@@ -246,6 +247,7 @@ class authorizationdb extends authorization
throw new Exception (_("Removing more than one object"), 412); throw new Exception (_("Removing more than one object"), 412);
if ($rc == 0) if ($rc == 0)
throw new Exception (_("No object removed"), 412); throw new Exception (_("No object removed"), 412);
$rc = $this->db->delete ("$object$this->separator%");
return TRUE; return TRUE;
} }
@@ -361,6 +363,7 @@ class authorizationdb extends authorization
throw new Exception (sprintf (_("Object %s doesn't exists"), $object), throw new Exception (sprintf (_("Object %s doesn't exists"), $object),
400); 400);
$search = reset ($search); $search = reset ($search);
// TODO : Don't update if the user is not the owner of the file
$this->db->update ($object, array ("modbits"=>$modbits)); $this->db->update ($object, array ("modbits"=>$modbits));
return TRUE; return TRUE;
} }