mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
Save user dashboards to Icinga Web 2's configuration directory
fixes #8056
This commit is contained in:
parent
6555a2ec0a
commit
9d6906bd64
@ -24,11 +24,11 @@ class DashboardController extends ActionController
|
||||
* @var Dashboard;
|
||||
*/
|
||||
private $dashboard;
|
||||
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dashboard = new Dashboard();
|
||||
$this->dashboard->setUser($this->getRequest()->getUser());
|
||||
$this->dashboard->setUser($this->Auth()->getUser());
|
||||
$this->dashboard->load();
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ use Icinga\Application\Config;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Exception\NotReadableError;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use Icinga\Exception\SystemPermissionException;
|
||||
use Icinga\User;
|
||||
use Icinga\Web\Widget\Dashboard\Pane;
|
||||
use Icinga\Web\Widget\Dashboard\Dashlet as DashboardDashlet;
|
||||
@ -425,28 +424,8 @@ class Dashboard extends AbstractWidget
|
||||
public function getConfigFile()
|
||||
{
|
||||
if ($this->user === null) {
|
||||
return '';
|
||||
throw new ProgrammingError('Can\'t load dashboards. User is not set');
|
||||
}
|
||||
|
||||
$baseDir = '/var/lib/icingaweb';
|
||||
|
||||
if (! file_exists($baseDir)) {
|
||||
throw new NotReadableError('Could not read: ' . $baseDir);
|
||||
}
|
||||
|
||||
$userDir = $baseDir . '/' . $this->user->getUsername();
|
||||
|
||||
if (! file_exists($userDir)) {
|
||||
$success = @mkdir($userDir);
|
||||
if (!$success) {
|
||||
throw new SystemPermissionException('Could not create: ' . $userDir);
|
||||
}
|
||||
}
|
||||
|
||||
if (! file_exists($userDir)) {
|
||||
throw new NotReadableError('Could not read: ' . $userDir);
|
||||
}
|
||||
|
||||
return $userDir . '/dashboard.ini';
|
||||
return Config::resolvePath('dashboards/' . $this->user->getUsername() . '/dashboard.ini');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user