Show cancel/kill actions in process page only if role is a superuser.
authorJehan-Guillaume (ioguix) de Rorthais <jgdr@dalibo.com>
Wed, 1 Jun 2011 19:32:04 +0000 (21:32 +0200)
committerJehan-Guillaume (ioguix) de Rorthais <jgdr@dalibo.com>
Wed, 1 Jun 2011 19:32:04 +0000 (21:32 +0200)
database.php

index 290d2a0a6c75fa7228aefc16d0ba844967613ea3..e20e67ea245e9d8b503742f6fcc615d2807266b6 100755 (executable)
 
                // Build possible actions for our process list
                $columns['actions'] = array('title' => $lang['stractions']);
-                       
-               $actions = array(
-                       'cancel' => array(
-                               'title' => $lang['strcancel'],
-                               'url'   => "database.php?action=signal&amp;signal=CANCEL&amp;{$misc->href}&amp;",
-                               'vars'  => array('procpid' => 'procpid')
-                       ),
-                       'kill' => array(
-                               'title' => $lang['strkill'],
-                               'url'   => "database.php?action=signal&amp;signal=KILL&amp;{$misc->href}&amp;",
-                               'vars'  => array('procpid' => 'procpid')
-                       )
-               );
+
+               $actions = array();
+               if ($data->isSuperUser()) {
+                       $actions = array(
+                               'cancel' => array(
+                                       'title' => $lang['strcancel'],
+                                       'url'   => "database.php?action=signal&amp;signal=CANCEL&amp;{$misc->href}&amp;",
+                                       'vars'  => array('procpid' => 'procpid')
+                               ),
+                               'kill' => array(
+                                       'title' => $lang['strkill'],
+                                       'url'   => "database.php?action=signal&amp;signal=KILL&amp;{$misc->href}&amp;",
+                                       'vars'  => array('procpid' => 'procpid')
+                               )
+                       );
        
-               // Remove actions where not supported
-               if (!$data->hasQueryKill()) unset($actions['kill']);
-               if (!$data->hasQueryCancel()) unset($actions['cancel']);
+                       // Remove actions where not supported
+                       if (!$data->hasQueryKill()) unset($actions['kill']);
+                       if (!$data->hasQueryCancel()) unset($actions['cancel']);
+               }
 
                if (count($actions) == 0) unset($columns['actions']);