Cleanup & uid from AuthLib

This commit is contained in:
cgfhtw
2022-10-13 08:43:08 +02:00
parent 6570c958b3
commit fd2aa8a1bb
3 changed files with 6 additions and 171 deletions
+5 -77
View File
@@ -22,13 +22,14 @@ class Config extends Auth_Controller
);
$this->load->library('dashboard/DashboardLib', null, 'DashboardLib');
$this->load->library('AuthLib', null, 'AuthLib');
}
public function index()
{
$dashboard_kurzbz = $this->input->get('db');
$uid = $this->input->get('uid');
$uid = $this->AuthLib->getAuthObj()->username;
$dashboard = $this->DashboardLib->getDashboardByKurzbz($dashboard_kurzbz);
if(!$dashboard) {
http_response_code(404);
@@ -113,7 +114,7 @@ class Config extends Auth_Controller
$input = json_decode($this->input->raw_input_stream);
$dashboard_kurzbz = $input->db;
$funktion_kurzbz = $input->funktion_kurzbz;
$uid = $input->uid;
$uid = $this->AuthLib->getAuthObj()->username;
$override = $this->DashboardLib->getOverrideOrCreateEmptyOverride($dashboard_kurzbz, $uid);
@@ -138,7 +139,7 @@ class Config extends Auth_Controller
$input = json_decode($this->input->raw_input_stream);
$dashboard_kurzbz = $input->db;
$funktion_kurzbz = $input->funktion_kurzbz;
$uid = $input->uid;
$uid = $this->AuthLib->getAuthObj()->username;
$widgetid = $input->widgetid;
$override = $this->DashboardLib->getOverride($dashboard_kurzbz, $uid);
@@ -167,77 +168,4 @@ class Config extends Auth_Controller
$this->outputJsonSuccess(array('msg' => 'override successfully updated.'));
}
public function dummy()
{
$defaultconfig = array(
'title' => 'CIS Dashboard',
'widgets' => array(
'nofunction' => array(
'd39ba153ac9e60a21ed694cc3728f4dd' => array(
'title' => 'test1',
'type' => 'kpi',
'config' => array(),
'place' => array(
'row' => 1,
'col' => 3,
'width' => 1,
'height' => 1
)
),
'c6c526b78a0e4bc3a0b67e00f983fc33' => array(
'title' => 'test2',
'type' => 'url',
'config' => array(),
'place' => array(
'row' => 3,
'col' => 1,
'width' => 1,
'height' => 1
)
),
),
'leitung' => array(
'3f1ebb24bdaa2b82fbdacf7d55977412' => array(
'title' => 'test3',
'type' => 'chart',
'config' => array(),
'place' => array(
'row' => 2,
'col' => 1,
'width' => 3,
'height' => 3
)
)
)
)
);
$userconfig = array(
'widgets' => array(
'nofunction' => array(
'd39ba153ac9e60a21ed694cc3728f4dd' => array(
'modifier' => 'bold',
'visible' => false,
'place' => array(
'width' => 2,
'height' => 2
)
),
'c6c526b78a0e4bc3a0b67e00f983fc33' => array(
'type' => 'test'
)
)
)
);
$merged = array_replace_recursive($defaultconfig, $userconfig);
$ret = array(
'defaultconfig' => $defaultconfig,
'userconfig' => $userconfig,
'merged' => $merged
);
$this->outputJsonSuccess($ret);
}
}