summaryrefslogtreecommitdiffstats
path: root/library/Director/Dashboard
diff options
context:
space:
mode:
Diffstat (limited to 'library/Director/Dashboard')
-rw-r--r--library/Director/Dashboard/BranchesDashboard.php10
-rw-r--r--library/Director/Dashboard/Dashboard.php1
-rw-r--r--library/Director/Dashboard/Dashlet/ActivityLogDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/ApiUserObjectDashlet.php6
-rw-r--r--library/Director/Dashboard/Dashlet/BasketDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/CheckCommandsDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/ChoicesDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/CommandObjectDashlet.php6
-rw-r--r--library/Director/Dashboard/Dashlet/CustomvarDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/DatafieldCategoryDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/DatafieldDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/DatalistDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/DependencyObjectDashlet.php2
-rw-r--r--library/Director/Dashboard/Dashlet/DeploymentDashlet.php3
-rw-r--r--library/Director/Dashboard/Dashlet/EndpointObjectDashlet.php5
-rw-r--r--library/Director/Dashboard/Dashlet/HostGroupsDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/HostObjectDashlet.php6
-rw-r--r--library/Director/Dashboard/Dashlet/HostTemplatesDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/HostsDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/ImportSourceDashlet.php3
-rw-r--r--library/Director/Dashboard/Dashlet/InfrastructureDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/JobDashlet.php3
-rw-r--r--library/Director/Dashboard/Dashlet/KickstartDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/NotificationApplyDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/NotificationTemplateDashlet.php6
-rw-r--r--library/Director/Dashboard/Dashlet/NotificationsDashlet.php6
-rw-r--r--library/Director/Dashboard/Dashlet/ScheduledDowntimeApplyDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/SelfServiceDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/ServiceApplyRulesDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/ServiceGroupsDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/ServiceObjectDashlet.php8
-rw-r--r--library/Director/Dashboard/Dashlet/ServiceSetsDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/ServiceTemplatesDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/SettingsDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/SingleServicesDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/SyncDashlet.php3
-rw-r--r--library/Director/Dashboard/Dashlet/TimeperiodObjectDashlet.php5
-rw-r--r--library/Director/Dashboard/Dashlet/TimeperiodTemplateDashlet.php6
-rw-r--r--library/Director/Dashboard/Dashlet/TimeperiodsDashlet.php6
-rw-r--r--library/Director/Dashboard/Dashlet/UserGroupsDashlet.php4
-rw-r--r--library/Director/Dashboard/Dashlet/UserObjectDashlet.php5
-rw-r--r--library/Director/Dashboard/Dashlet/UserTemplateDashlet.php6
-rw-r--r--library/Director/Dashboard/Dashlet/UsersDashlet.php6
-rw-r--r--library/Director/Dashboard/Dashlet/ZoneObjectDashlet.php6
44 files changed, 141 insertions, 59 deletions
diff --git a/library/Director/Dashboard/BranchesDashboard.php b/library/Director/Dashboard/BranchesDashboard.php
index fe8b385..faeb8bf 100644
--- a/library/Director/Dashboard/BranchesDashboard.php
+++ b/library/Director/Dashboard/BranchesDashboard.php
@@ -4,8 +4,10 @@ namespace Icinga\Module\Director\Dashboard;
use gipfl\Web\Widget\Hint;
use Icinga\Application\Hook;
+use Icinga\Authentication\Auth;
use Icinga\Module\Director\Db\Branch\Branch;
use Icinga\Module\Director\Db\Branch\BranchStore;
+use Icinga\Module\Director\Db\Branch\PreferredBranchSupport;
use Icinga\Module\Director\Hook\BranchSupportHook;
use ipl\Html\Html;
@@ -19,6 +21,14 @@ class BranchesDashboard extends Dashboard
$this->translate('You\'re currently working in a Configuration Branch: %s'),
Branch::requireHook()->linkToBranch($branch, $this->getAuth(), $branch->getName())
)));
+ } else {
+ if (($implementation = Branch::optionalHook()) && $implementation instanceof PreferredBranchSupport) {
+ if ($implementation->hasPreferredBranch(Auth::getInstance())) {
+ $this->prepend(Hint::warning(
+ $this->translate('You\'re currently working in the main Configuration Branch')
+ ));
+ }
+ }
}
return $this->translate('Prepare your configuration in a safe Environment');
diff --git a/library/Director/Dashboard/Dashboard.php b/library/Director/Dashboard/Dashboard.php
index de8970c..3f1fc38 100644
--- a/library/Director/Dashboard/Dashboard.php
+++ b/library/Director/Dashboard/Dashboard.php
@@ -149,6 +149,7 @@ abstract class Dashboard extends HtmlDocument
]);
}
+ #[\ReturnTypeWillChange]
public function count()
{
return count($this->dashlets());
diff --git a/library/Director/Dashboard/Dashlet/ActivityLogDashlet.php b/library/Director/Dashboard/Dashlet/ActivityLogDashlet.php
index 9794986..7a9745b 100644
--- a/library/Director/Dashboard/Dashlet/ActivityLogDashlet.php
+++ b/library/Director/Dashboard/Dashlet/ActivityLogDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class ActivityLogDashlet extends Dashlet
{
protected $icon = 'book';
@@ -30,6 +32,6 @@ class ActivityLogDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/audit');
+ return [Permission::AUDIT];
}
}
diff --git a/library/Director/Dashboard/Dashlet/ApiUserObjectDashlet.php b/library/Director/Dashboard/Dashlet/ApiUserObjectDashlet.php
index 419859d..238059a 100644
--- a/library/Director/Dashboard/Dashlet/ApiUserObjectDashlet.php
+++ b/library/Director/Dashboard/Dashlet/ApiUserObjectDashlet.php
@@ -2,11 +2,13 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class ApiUserObjectDashlet extends Dashlet
{
protected $icon = 'lock-open-alt';
- protected $requiredStats = array('apiuser');
+ protected $requiredStats = ['apiuser'];
public function getTitle()
{
@@ -20,6 +22,6 @@ class ApiUserObjectDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/BasketDashlet.php b/library/Director/Dashboard/Dashlet/BasketDashlet.php
index 10f2b81..8ac26ed 100644
--- a/library/Director/Dashboard/Dashlet/BasketDashlet.php
+++ b/library/Director/Dashboard/Dashlet/BasketDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class BasketDashlet extends Dashlet
{
protected $icon = 'tag';
@@ -25,6 +27,6 @@ class BasketDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/CheckCommandsDashlet.php b/library/Director/Dashboard/Dashlet/CheckCommandsDashlet.php
index 65d8c8c..458c700 100644
--- a/library/Director/Dashboard/Dashlet/CheckCommandsDashlet.php
+++ b/library/Director/Dashboard/Dashlet/CheckCommandsDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class CheckCommandsDashlet extends Dashlet
{
protected $icon = 'wrench';
@@ -21,7 +23,7 @@ class CheckCommandsDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
public function getUrl()
diff --git a/library/Director/Dashboard/Dashlet/ChoicesDashlet.php b/library/Director/Dashboard/Dashlet/ChoicesDashlet.php
index efdbba5..105ebb9 100644
--- a/library/Director/Dashboard/Dashlet/ChoicesDashlet.php
+++ b/library/Director/Dashboard/Dashlet/ChoicesDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
abstract class ChoicesDashlet extends Dashlet
{
protected $icon = 'flapping';
@@ -36,6 +38,6 @@ abstract class ChoicesDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/CommandObjectDashlet.php b/library/Director/Dashboard/Dashlet/CommandObjectDashlet.php
index 083172e..18a4731 100644
--- a/library/Director/Dashboard/Dashlet/CommandObjectDashlet.php
+++ b/library/Director/Dashboard/Dashlet/CommandObjectDashlet.php
@@ -2,11 +2,13 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class CommandObjectDashlet extends Dashlet
{
protected $icon = 'wrench';
- protected $requiredStats = array('command');
+ protected $requiredStats = ['command'];
public function getTitle()
{
@@ -20,6 +22,6 @@ class CommandObjectDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/CustomvarDashlet.php b/library/Director/Dashboard/Dashlet/CustomvarDashlet.php
index 919c06b..a2acd54 100644
--- a/library/Director/Dashboard/Dashlet/CustomvarDashlet.php
+++ b/library/Director/Dashboard/Dashlet/CustomvarDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class CustomvarDashlet extends Dashlet
{
protected $icon = 'keyboard';
@@ -25,6 +27,6 @@ class CustomvarDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/DatafieldCategoryDashlet.php b/library/Director/Dashboard/Dashlet/DatafieldCategoryDashlet.php
index 6efb4ca..eb1cefc 100644
--- a/library/Director/Dashboard/Dashlet/DatafieldCategoryDashlet.php
+++ b/library/Director/Dashboard/Dashlet/DatafieldCategoryDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class DatafieldCategoryDashlet extends Dashlet
{
protected $icon = 'th-list';
@@ -25,6 +27,6 @@ class DatafieldCategoryDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/DatafieldDashlet.php b/library/Director/Dashboard/Dashlet/DatafieldDashlet.php
index 03f2d8d..a381a3f 100644
--- a/library/Director/Dashboard/Dashlet/DatafieldDashlet.php
+++ b/library/Director/Dashboard/Dashlet/DatafieldDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class DatafieldDashlet extends Dashlet
{
protected $icon = 'edit';
@@ -25,6 +27,6 @@ class DatafieldDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/DatalistDashlet.php b/library/Director/Dashboard/Dashlet/DatalistDashlet.php
index bdf179f..fe82e4b 100644
--- a/library/Director/Dashboard/Dashlet/DatalistDashlet.php
+++ b/library/Director/Dashboard/Dashlet/DatalistDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class DatalistDashlet extends Dashlet
{
protected $icon = 'sort-name-up';
@@ -25,6 +27,6 @@ class DatalistDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/DependencyObjectDashlet.php b/library/Director/Dashboard/Dashlet/DependencyObjectDashlet.php
index 47a18aa..b6455fe 100644
--- a/library/Director/Dashboard/Dashlet/DependencyObjectDashlet.php
+++ b/library/Director/Dashboard/Dashlet/DependencyObjectDashlet.php
@@ -6,7 +6,7 @@ class DependencyObjectDashlet extends Dashlet
{
protected $icon = 'sitemap';
- protected $requiredStats = array('dependency');
+ protected $requiredStats = ['dependency'];
public function getTitle()
{
diff --git a/library/Director/Dashboard/Dashlet/DeploymentDashlet.php b/library/Director/Dashboard/Dashlet/DeploymentDashlet.php
index 7a52793..83b4cea 100644
--- a/library/Director/Dashboard/Dashlet/DeploymentDashlet.php
+++ b/library/Director/Dashboard/Dashlet/DeploymentDashlet.php
@@ -3,6 +3,7 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
use Exception;
+use Icinga\Module\Director\Auth\Permission;
use Icinga\Module\Director\Objects\DirectorDeploymentLog;
class DeploymentDashlet extends Dashlet
@@ -109,6 +110,6 @@ class DeploymentDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/deploy');
+ return [Permission::DEPLOY];
}
}
diff --git a/library/Director/Dashboard/Dashlet/EndpointObjectDashlet.php b/library/Director/Dashboard/Dashlet/EndpointObjectDashlet.php
index 9dd9467..97ae746 100644
--- a/library/Director/Dashboard/Dashlet/EndpointObjectDashlet.php
+++ b/library/Director/Dashboard/Dashlet/EndpointObjectDashlet.php
@@ -3,12 +3,13 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
use Exception;
+use Icinga\Module\Director\Auth\Permission;
class EndpointObjectDashlet extends Dashlet
{
protected $icon = 'cloud';
- protected $requiredStats = array('endpoint');
+ protected $requiredStats = ['endpoint'];
protected $hasDeploymentEndpoint;
@@ -24,7 +25,7 @@ class EndpointObjectDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
protected function hasDeploymentEndpoint()
diff --git a/library/Director/Dashboard/Dashlet/HostGroupsDashlet.php b/library/Director/Dashboard/Dashlet/HostGroupsDashlet.php
index 5d3b25f..249d4d6 100644
--- a/library/Director/Dashboard/Dashlet/HostGroupsDashlet.php
+++ b/library/Director/Dashboard/Dashlet/HostGroupsDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class HostGroupsDashlet extends Dashlet
{
protected $icon = 'tags';
@@ -26,6 +28,6 @@ class HostGroupsDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/hostgroups');
+ return [Permission::HOST_GROUPS];
}
}
diff --git a/library/Director/Dashboard/Dashlet/HostObjectDashlet.php b/library/Director/Dashboard/Dashlet/HostObjectDashlet.php
index 10cff94..e77f75b 100644
--- a/library/Director/Dashboard/Dashlet/HostObjectDashlet.php
+++ b/library/Director/Dashboard/Dashlet/HostObjectDashlet.php
@@ -2,11 +2,13 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class HostObjectDashlet extends Dashlet
{
protected $icon = 'host';
- protected $requiredStats = array('host', 'hostgroup');
+ protected $requiredStats = ['host', 'hostgroup'];
public function getTitle()
{
@@ -15,7 +17,7 @@ class HostObjectDashlet extends Dashlet
public function listRequiredPermissions()
{
- return ['director/hosts'];
+ return [Permission::HOSTS];
}
public function getUrl()
diff --git a/library/Director/Dashboard/Dashlet/HostTemplatesDashlet.php b/library/Director/Dashboard/Dashlet/HostTemplatesDashlet.php
index 09bed17..eb4092a 100644
--- a/library/Director/Dashboard/Dashlet/HostTemplatesDashlet.php
+++ b/library/Director/Dashboard/Dashlet/HostTemplatesDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class HostTemplatesDashlet extends Dashlet
{
protected $icon = 'cubes';
@@ -26,6 +28,6 @@ class HostTemplatesDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/HostsDashlet.php b/library/Director/Dashboard/Dashlet/HostsDashlet.php
index 39c1421..55bebbd 100644
--- a/library/Director/Dashboard/Dashlet/HostsDashlet.php
+++ b/library/Director/Dashboard/Dashlet/HostsDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class HostsDashlet extends Dashlet
{
protected $icon = 'host';
@@ -27,6 +29,6 @@ class HostsDashlet extends Dashlet
public function listRequiredPermissions()
{
- return ['director/hosts'];
+ return [Permission::HOSTS];
}
}
diff --git a/library/Director/Dashboard/Dashlet/ImportSourceDashlet.php b/library/Director/Dashboard/Dashlet/ImportSourceDashlet.php
index 302c1ed..aa34613 100644
--- a/library/Director/Dashboard/Dashlet/ImportSourceDashlet.php
+++ b/library/Director/Dashboard/Dashlet/ImportSourceDashlet.php
@@ -3,6 +3,7 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
use Exception;
+use Icinga\Module\Director\Auth\Permission;
use Icinga\Module\Director\Objects\ImportSource;
class ImportSourceDashlet extends Dashlet
@@ -60,6 +61,6 @@ class ImportSourceDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/InfrastructureDashlet.php b/library/Director/Dashboard/Dashlet/InfrastructureDashlet.php
index 328df72..e1d5908 100644
--- a/library/Director/Dashboard/Dashlet/InfrastructureDashlet.php
+++ b/library/Director/Dashboard/Dashlet/InfrastructureDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class InfrastructureDashlet extends Dashlet
{
protected $icon = 'cloud';
@@ -25,6 +27,6 @@ class InfrastructureDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/JobDashlet.php b/library/Director/Dashboard/Dashlet/JobDashlet.php
index d7452e0..af5429d 100644
--- a/library/Director/Dashboard/Dashlet/JobDashlet.php
+++ b/library/Director/Dashboard/Dashlet/JobDashlet.php
@@ -3,6 +3,7 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
use Exception;
+use Icinga\Module\Director\Auth\Permission;
use Icinga\Module\Director\Objects\DirectorJob;
class JobDashlet extends Dashlet
@@ -60,6 +61,6 @@ class JobDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/KickstartDashlet.php b/library/Director/Dashboard/Dashlet/KickstartDashlet.php
index 09801f5..eb74371 100644
--- a/library/Director/Dashboard/Dashlet/KickstartDashlet.php
+++ b/library/Director/Dashboard/Dashlet/KickstartDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class KickstartDashlet extends Dashlet
{
protected $icon = 'gauge';
@@ -26,6 +28,6 @@ class KickstartDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/NotificationApplyDashlet.php b/library/Director/Dashboard/Dashlet/NotificationApplyDashlet.php
index e0b0443..d0dbb01 100644
--- a/library/Director/Dashboard/Dashlet/NotificationApplyDashlet.php
+++ b/library/Director/Dashboard/Dashlet/NotificationApplyDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class NotificationApplyDashlet extends Dashlet
{
protected $icon = 'bell';
@@ -27,7 +29,7 @@ class NotificationApplyDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/notifications');
+ return [Permission::NOTIFICATIONS];
}
public function getUrl()
diff --git a/library/Director/Dashboard/Dashlet/NotificationTemplateDashlet.php b/library/Director/Dashboard/Dashlet/NotificationTemplateDashlet.php
index a58b5d0..6f1fe64 100644
--- a/library/Director/Dashboard/Dashlet/NotificationTemplateDashlet.php
+++ b/library/Director/Dashboard/Dashlet/NotificationTemplateDashlet.php
@@ -2,11 +2,13 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class NotificationTemplateDashlet extends Dashlet
{
protected $icon = 'cubes';
- protected $requiredStats = array('notification');
+ protected $requiredStats = ['notification'];
public function getTitle()
{
@@ -21,7 +23,7 @@ class NotificationTemplateDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
public function getUrl()
diff --git a/library/Director/Dashboard/Dashlet/NotificationsDashlet.php b/library/Director/Dashboard/Dashlet/NotificationsDashlet.php
index 85610f0..a0b1e43 100644
--- a/library/Director/Dashboard/Dashlet/NotificationsDashlet.php
+++ b/library/Director/Dashboard/Dashlet/NotificationsDashlet.php
@@ -2,11 +2,13 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class NotificationsDashlet extends Dashlet
{
protected $icon = 'bell';
- protected $requiredStats = array('notification');
+ protected $requiredStats = ['notification'];
public function getTitle()
{
@@ -23,7 +25,7 @@ class NotificationsDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/notifications');
+ return [Permission::NOTIFICATIONS];
}
public function getUrl()
diff --git a/library/Director/Dashboard/Dashlet/ScheduledDowntimeApplyDashlet.php b/library/Director/Dashboard/Dashlet/ScheduledDowntimeApplyDashlet.php
index 45bcfa2..c9fbb68 100644
--- a/library/Director/Dashboard/Dashlet/ScheduledDowntimeApplyDashlet.php
+++ b/library/Director/Dashboard/Dashlet/ScheduledDowntimeApplyDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class ScheduledDowntimeApplyDashlet extends Dashlet
{
protected $icon = 'plug';
@@ -15,7 +17,7 @@ class ScheduledDowntimeApplyDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/scheduled-downtimes');
+ return [Permission::SCHEDULED_DOWNTIMES];
}
public function getUrl()
diff --git a/library/Director/Dashboard/Dashlet/SelfServiceDashlet.php b/library/Director/Dashboard/Dashlet/SelfServiceDashlet.php
index 32b1cfa..b3d15fc 100644
--- a/library/Director/Dashboard/Dashlet/SelfServiceDashlet.php
+++ b/library/Director/Dashboard/Dashlet/SelfServiceDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class SelfServiceDashlet extends Dashlet
{
protected $icon = 'chat';
@@ -26,6 +28,6 @@ class SelfServiceDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/ServiceApplyRulesDashlet.php b/library/Director/Dashboard/Dashlet/ServiceApplyRulesDashlet.php
index b4bee04..487be02 100644
--- a/library/Director/Dashboard/Dashlet/ServiceApplyRulesDashlet.php
+++ b/library/Director/Dashboard/Dashlet/ServiceApplyRulesDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class ServiceApplyRulesDashlet extends Dashlet
{
protected $icon = 'resize-full-alt';
@@ -26,6 +28,6 @@ class ServiceApplyRulesDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/ServiceGroupsDashlet.php b/library/Director/Dashboard/Dashlet/ServiceGroupsDashlet.php
index ad47768..44162a9 100644
--- a/library/Director/Dashboard/Dashlet/ServiceGroupsDashlet.php
+++ b/library/Director/Dashboard/Dashlet/ServiceGroupsDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class ServiceGroupsDashlet extends Dashlet
{
protected $icon = 'tags';
@@ -26,6 +28,6 @@ class ServiceGroupsDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/ServiceObjectDashlet.php b/library/Director/Dashboard/Dashlet/ServiceObjectDashlet.php
index 01fb800..087590b 100644
--- a/library/Director/Dashboard/Dashlet/ServiceObjectDashlet.php
+++ b/library/Director/Dashboard/Dashlet/ServiceObjectDashlet.php
@@ -3,6 +3,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
use Icinga\Module\Director\Acl;
+use Icinga\Module\Director\Auth\Permission;
+use RuntimeException;
class ServiceObjectDashlet extends Dashlet
{
@@ -22,13 +24,13 @@ class ServiceObjectDashlet extends Dashlet
public function listRequiredPermissions()
{
- return ['director/services'];
+ throw new RuntimeException('This method should not be accessed, isAllowed() has been implemented');
}
public function isAllowed()
{
$acl = Acl::instance();
- return $acl->hasPermission('director/services')
- || $acl->hasPermission('director/service_sets');
+ return $acl->hasPermission(Permission::SERVICES)
+ || $acl->hasPermission(Permission::SERVICE_SETS);
}
}
diff --git a/library/Director/Dashboard/Dashlet/ServiceSetsDashlet.php b/library/Director/Dashboard/Dashlet/ServiceSetsDashlet.php
index f971d42..c8db0e9 100644
--- a/library/Director/Dashboard/Dashlet/ServiceSetsDashlet.php
+++ b/library/Director/Dashboard/Dashlet/ServiceSetsDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class ServiceSetsDashlet extends Dashlet
{
protected $icon = 'services';
@@ -26,6 +28,6 @@ class ServiceSetsDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/servicesets');
+ return [Permission::SERVICE_SETS];
}
}
diff --git a/library/Director/Dashboard/Dashlet/ServiceTemplatesDashlet.php b/library/Director/Dashboard/Dashlet/ServiceTemplatesDashlet.php
index 62d1b41..c2131d6 100644
--- a/library/Director/Dashboard/Dashlet/ServiceTemplatesDashlet.php
+++ b/library/Director/Dashboard/Dashlet/ServiceTemplatesDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class ServiceTemplatesDashlet extends Dashlet
{
protected $icon = 'cubes';
@@ -26,6 +28,6 @@ class ServiceTemplatesDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/SettingsDashlet.php b/library/Director/Dashboard/Dashlet/SettingsDashlet.php
index 716e565..0a3d680 100644
--- a/library/Director/Dashboard/Dashlet/SettingsDashlet.php
+++ b/library/Director/Dashboard/Dashlet/SettingsDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class SettingsDashlet extends Dashlet
{
protected $icon = 'edit';
@@ -25,6 +27,6 @@ class SettingsDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/SingleServicesDashlet.php b/library/Director/Dashboard/Dashlet/SingleServicesDashlet.php
index 297b3f8..a7d648a 100644
--- a/library/Director/Dashboard/Dashlet/SingleServicesDashlet.php
+++ b/library/Director/Dashboard/Dashlet/SingleServicesDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class SingleServicesDashlet extends Dashlet
{
protected $icon = 'service';
@@ -26,6 +28,6 @@ class SingleServicesDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/services');
+ return [Permission::SERVICES];
}
}
diff --git a/library/Director/Dashboard/Dashlet/SyncDashlet.php b/library/Director/Dashboard/Dashlet/SyncDashlet.php
index 4ac689a..d212bc2 100644
--- a/library/Director/Dashboard/Dashlet/SyncDashlet.php
+++ b/library/Director/Dashboard/Dashlet/SyncDashlet.php
@@ -3,6 +3,7 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
use Exception;
+use Icinga\Module\Director\Auth\Permission;
use Icinga\Module\Director\Objects\SyncRule;
class SyncDashlet extends Dashlet
@@ -60,6 +61,6 @@ class SyncDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/TimeperiodObjectDashlet.php b/library/Director/Dashboard/Dashlet/TimeperiodObjectDashlet.php
index ba4c1db..2aa4c9b 100644
--- a/library/Director/Dashboard/Dashlet/TimeperiodObjectDashlet.php
+++ b/library/Director/Dashboard/Dashlet/TimeperiodObjectDashlet.php
@@ -4,12 +4,13 @@ namespace Icinga\Module\Director\Dashboard\Dashlet;
use DirectoryIterator;
use Icinga\Exception\ProgrammingError;
+use Icinga\Module\Director\Auth\Permission;
class TimeperiodObjectDashlet extends Dashlet
{
protected $icon = 'calendar';
- protected $requiredStats = array('timeperiod');
+ protected $requiredStats = ['timeperiod'];
public function getTitle()
{
@@ -23,6 +24,6 @@ class TimeperiodObjectDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/TimeperiodTemplateDashlet.php b/library/Director/Dashboard/Dashlet/TimeperiodTemplateDashlet.php
index 26339e4..7aa3201 100644
--- a/library/Director/Dashboard/Dashlet/TimeperiodTemplateDashlet.php
+++ b/library/Director/Dashboard/Dashlet/TimeperiodTemplateDashlet.php
@@ -2,11 +2,13 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class TimeperiodTemplateDashlet extends Dashlet
{
protected $icon = 'cubes';
- protected $requiredStats = array('timeperiod');
+ protected $requiredStats = ['timeperiod'];
public function getTitle()
{
@@ -21,7 +23,7 @@ class TimeperiodTemplateDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
public function getUrl()
diff --git a/library/Director/Dashboard/Dashlet/TimeperiodsDashlet.php b/library/Director/Dashboard/Dashlet/TimeperiodsDashlet.php
index 5a54bec..827cc12 100644
--- a/library/Director/Dashboard/Dashlet/TimeperiodsDashlet.php
+++ b/library/Director/Dashboard/Dashlet/TimeperiodsDashlet.php
@@ -2,11 +2,13 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class TimeperiodsDashlet extends Dashlet
{
protected $icon = 'calendar';
- protected $requiredStats = array('timeperiod');
+ protected $requiredStats = ['timeperiod'];
public function getTitle()
{
@@ -20,6 +22,6 @@ class TimeperiodsDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/UserGroupsDashlet.php b/library/Director/Dashboard/Dashlet/UserGroupsDashlet.php
index 3fba4ba..792e140 100644
--- a/library/Director/Dashboard/Dashlet/UserGroupsDashlet.php
+++ b/library/Director/Dashboard/Dashlet/UserGroupsDashlet.php
@@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class UserGroupsDashlet extends Dashlet
{
protected $icon = 'tags';
@@ -26,6 +28,6 @@ class UserGroupsDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}
diff --git a/library/Director/Dashboard/Dashlet/UserObjectDashlet.php b/library/Director/Dashboard/Dashlet/UserObjectDashlet.php
index 463b84c..7e4f511 100644
--- a/library/Director/Dashboard/Dashlet/UserObjectDashlet.php
+++ b/library/Director/Dashboard/Dashlet/UserObjectDashlet.php
@@ -2,14 +2,11 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
-use DirectoryIterator;
-use Icinga\Exception\ProgrammingError;
-
class UserObjectDashlet extends Dashlet
{
protected $icon = 'users';
- protected $requiredStats = array('user', 'usergroup');
+ protected $requiredStats = ['user', 'usergroup'];
public function getTitle()
{
diff --git a/library/Director/Dashboard/Dashlet/UserTemplateDashlet.php b/library/Director/Dashboard/Dashlet/UserTemplateDashlet.php
index 291ab05..c00215d 100644
--- a/library/Director/Dashboard/Dashlet/UserTemplateDashlet.php
+++ b/library/Director/Dashboard/Dashlet/UserTemplateDashlet.php
@@ -2,11 +2,13 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class UserTemplateDashlet extends Dashlet
{
protected $icon = 'cubes';
- protected $requiredStats = array('user');
+ protected $requiredStats = ['user'];
public function getTitle()
{
@@ -21,7 +23,7 @@ class UserTemplateDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
public function getUrl()
diff --git a/library/Director/Dashboard/Dashlet/UsersDashlet.php b/library/Director/Dashboard/Dashlet/UsersDashlet.php
index 43ddc26..4f0c7d7 100644
--- a/library/Director/Dashboard/Dashlet/UsersDashlet.php
+++ b/library/Director/Dashboard/Dashlet/UsersDashlet.php
@@ -2,11 +2,13 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class UsersDashlet extends Dashlet
{
protected $icon = 'users';
- protected $requiredStats = array('user', 'usergroup');
+ protected $requiredStats = ['user', 'usergroup'];
public function getTitle()
{
@@ -15,7 +17,7 @@ class UsersDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/users');
+ return [Permission::USERS];
}
public function getUrl()
diff --git a/library/Director/Dashboard/Dashlet/ZoneObjectDashlet.php b/library/Director/Dashboard/Dashlet/ZoneObjectDashlet.php
index ee789f2..f2ff8c8 100644
--- a/library/Director/Dashboard/Dashlet/ZoneObjectDashlet.php
+++ b/library/Director/Dashboard/Dashlet/ZoneObjectDashlet.php
@@ -2,11 +2,13 @@
namespace Icinga\Module\Director\Dashboard\Dashlet;
+use Icinga\Module\Director\Auth\Permission;
+
class ZoneObjectDashlet extends Dashlet
{
protected $icon = 'globe';
- protected $requiredStats = array('zone');
+ protected $requiredStats = ['zone'];
public function getTitle()
{
@@ -20,6 +22,6 @@ class ZoneObjectDashlet extends Dashlet
public function listRequiredPermissions()
{
- return array('director/admin');
+ return [Permission::ADMIN];
}
}