From 9a59f3529c927516e7eaf1c26839d49a4e2a61bb Mon Sep 17 00:00:00 2001
From: Eric Lippmann <eric.lippmann@netways.de>
Date: Thu, 22 Jan 2015 16:56:00 +0100
Subject: [PATCH] monitoring: Group permissions by topic where it makes sense,
 i.e. downtime and comment

---
 .../controllers/HostController.php            |  4 +-
 .../controllers/ServiceController.php         |  4 +-
 modules/monitoring/configuration.php          | 40 +++++++++----------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/modules/monitoring/application/controllers/HostController.php b/modules/monitoring/application/controllers/HostController.php
index 5daae0f23..d01335734 100644
--- a/modules/monitoring/application/controllers/HostController.php
+++ b/modules/monitoring/application/controllers/HostController.php
@@ -58,7 +58,7 @@ class Monitoring_HostController extends MonitoredObjectController
      */
     public function addCommentAction()
     {
-        $this->assertPermission('monitoring/command/add-comment');
+        $this->assertPermission('monitoring/command/comment/add');
 
         $this->view->title = $this->translate('Add Host Comment');
         $this->handleCommandForm(new AddCommentCommandForm());
@@ -80,7 +80,7 @@ class Monitoring_HostController extends MonitoredObjectController
      */
     public function scheduleDowntimeAction()
     {
-        $this->assertPermission('monitoring/command/schedule-downtime');
+        $this->assertPermission('monitoring/command/downtime/schedule');
 
         $this->view->title = $this->translate('Schedule Host Downtime');
         $this->handleCommandForm(new ScheduleHostDowntimeCommandForm());
diff --git a/modules/monitoring/application/controllers/ServiceController.php b/modules/monitoring/application/controllers/ServiceController.php
index 522a02efc..c05683400 100644
--- a/modules/monitoring/application/controllers/ServiceController.php
+++ b/modules/monitoring/application/controllers/ServiceController.php
@@ -58,7 +58,7 @@ class Monitoring_ServiceController extends MonitoredObjectController
      */
     public function addCommentAction()
     {
-        $this->assertPermission('monitoring/command/add-comment');
+        $this->assertPermission('monitoring/command/comment/add');
 
         $this->view->title = $this->translate('Add Service Comment');
         $this->handleCommandForm(new AddCommentCommandForm());
@@ -80,7 +80,7 @@ class Monitoring_ServiceController extends MonitoredObjectController
      */
     public function scheduleDowntimeAction()
     {
-        $this->assertPermission('monitoring/command/schedule-downtime');
+        $this->assertPermission('monitoring/command/downtime/schedule');
 
         $this->view->title = $this->translate('Schedule Service Downtime');
         $this->handleCommandForm(new ScheduleServiceDowntimeCommandForm());
diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php
index 432cb36ba..ed94f1545 100644
--- a/modules/monitoring/configuration.php
+++ b/modules/monitoring/configuration.php
@@ -8,41 +8,41 @@ $this->providePermission(
     'monitoring/command/*',
     $this->translate('Allow all commands')
 );
-$this->providePermission(
-    'monitoring/command/schedule*',
-    $this->translate('Allow scheduling checks and downtimes')
-);
 $this->providePermission(
     'monitoring/command/schedule-check',
     $this->translate('Allow scheduling host and service checks')
 );
-$this->providePermission(
-    'monitoring/command/schedule-downtime',
-    $this->translate('Allow scheduling host and service downtimes')
-);
 $this->providePermission(
     'monitoring/command/acknowledge-problem',
     $this->translate('Allow acknowledging host and service problems')
 );
-$this->providePermission(
-    'monitoring/command/add-comment',
-    $this->translate('Allow commenting on hosts and services')
-);
-$this->providePermission(
-    'monitoring/command/remove*',
-    $this->translate('Allow removing problem acknowledgements, host and service comments and downtimes')
-);
 $this->providePermission(
     'monitoring/command/remove-acknowledgement',
     $this->translate('Allow removing problem acknowledgements')
 );
 $this->providePermission(
-    'monitoring/command/remove-comment',
-    $this->translate('Allow removing host and service comments')
+    'monitoring/command/comment/*',
+    $this->translate('Allow adding and deleting host and service comments')
 );
 $this->providePermission(
-    'monitoring/command/remove-downtime',
-    $this->translate('Allow removing host and service downtimes')
+    'monitoring/command/comment/add',
+    $this->translate('Allow commenting on hosts and services')
+);
+$this->providePermission(
+    'monitoring/command/comment/delete',
+    $this->translate('Allow deleting host and service comments')
+);
+$this->providePermission(
+    'monitoring/command/downtime/*',
+    $this->translate('Allow scheduling and deleting host and service downtimes')
+);
+$this->providePermission(
+    'monitoring/command/downtime/schedule',
+    $this->translate('Allow scheduling host and service downtimes')
+);
+$this->providePermission(
+    'monitoring/command/downtime/delete',
+    $this->translate('Allow deleting host and service downtimes')
 );
 $this->providePermission(
     'monitoring/command/process-check-result',