routeSQL : Limit the list to the authorized of elements
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2044 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
23
routeSQL.php
23
routeSQL.php
@@ -357,6 +357,13 @@ class routeSQL
|
||||
$data = $this->objectDB->read ($criteria, array_keys ($titles), null,
|
||||
true, $foreignSelect);
|
||||
}
|
||||
// Limiting access to data only to data with read access right
|
||||
foreach ($data as $key=>$vals)
|
||||
{
|
||||
if ($this->accessright ($this->authHTML["email"],
|
||||
$vals[$this->objectDB->primary]) !== TRUE)
|
||||
unset ($data[$key]);
|
||||
}
|
||||
|
||||
$this->renderrest ($extension, $data);
|
||||
});
|
||||
@@ -667,6 +674,13 @@ class routeSQL
|
||||
$data = $this->objectDB->read ($criteria, array_keys ($titles), null,
|
||||
true, $foreignSelect);
|
||||
}
|
||||
// Limiting access to data only to data with read access right
|
||||
foreach ($data as $key=>$vals)
|
||||
{
|
||||
if ($this->accessright ($this->authHTML["email"],
|
||||
$vals[$this->objectDB->primary]) !== TRUE)
|
||||
unset ($data[$key]);
|
||||
}
|
||||
$nbentries = count ($data);
|
||||
if ($num > 1000)
|
||||
$route->redirect ("/".str_replace ("{chain}", $chain, $this->url_prefix)
|
||||
@@ -1308,7 +1322,8 @@ class routeSQL
|
||||
// var_export($this->model_class, TRUE)."\n";
|
||||
if ($this->authorization !== null)
|
||||
{
|
||||
$result = $this->authorization->allow ($this->module, $auth, "/$id");
|
||||
$result = $this->authorization->allow ($this->module, $auth,
|
||||
"/".$this->model_class."/$id");
|
||||
// echo "RESULT=$result\n";
|
||||
if ($result === "RO") return TRUE;
|
||||
if ($result === "RW") return TRUE;
|
||||
@@ -1325,7 +1340,8 @@ class routeSQL
|
||||
// var_export($this->model_class, TRUE)."\n";
|
||||
if ($this->authorization !== null)
|
||||
{
|
||||
$result = $this->authorization->allow ($this->module, $auth, "/$id");
|
||||
$result = $this->authorization->allow ($this->module, $auth,
|
||||
"/".$this->model_class."/$id");
|
||||
// echo "RESULT=$result\n";
|
||||
if ($result === "RW") return TRUE;
|
||||
return FALSE;
|
||||
@@ -1341,7 +1357,8 @@ class routeSQL
|
||||
// var_export($this->model_class, TRUE)."\n";
|
||||
if ($this->authorization !== null)
|
||||
{
|
||||
$result = $this->authorization->allow ($this->module, $auth, "/$id");
|
||||
$result = $this->authorization->allow ($this->module, $auth,
|
||||
"/".$this->model_class."/$id");
|
||||
// echo "RESULT=$result\n";
|
||||
if ($result === "RO") return TRUE;
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user