Skip to content
Snippets Groups Projects
Commit 87739b67 authored by Armand Bahi's avatar Armand Bahi
Browse files

Fix public user mixed modes

parent aa218bdc
No related branches found
No related tags found
No related merge requests found
......@@ -133,7 +133,7 @@ class Modes extends Vitis {
if ($this->oConnection->oError == null) {
if (!empty($this->aProperties["public_token"]) && $this->aProperties["allow_public_connection"] === true){
if($this->aProperties["public_token"] === $this->aValues['token']) {
$this->aValues["filter"] = '{"relation": "AND","operators":[{"column": "mode_id","compare_operator": "<>","value": "user"}]}';
$this->aValues["filter"] = $this->getPublicUserFilter();
}
}
if (isset($this->aValues['action']) && !empty($this->aValues['action'])) {
......@@ -170,6 +170,34 @@ class Modes extends Vitis {
return $sMessage;
}
/**
* Get the public user JSON filter
*
* @return {type} string
*/
function getPublicUserFilter(){
$aFilter = array(
'relation' => 'AND',
'operators' => array()
);
// Filtre passé dans l'URL
if (!empty($this->aValues["filter"])) {
$aRequestFilter = json_decode($this->aValues["filter"]);
array_push($aFilter['operators'], $aRequestFilter);
}
// Filtre public_user
array_push($aFilter['operators'], array(
'column' => 'mode_id',
'compare_operator' => '<>',
'value' => 'user'
));
return json_encode($aFilter);
}
/**
* @SWG\Put(path="/modes/sorting",
* tags={"Modes"},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment