Changeset 6692

Show
Ignore:
Timestamp:
10/02/08 11:39:19 (2 months ago)
Author:
dduponchelle
Message:

Introduce new actions access in Centreon commands.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/centreon/www/include/monitoring/external_cmd/functions.php

    r6646 r6692  
    4444         
    4545        // Re-Schedule for all service of an host 
    46          
    4746        function schedule_host_svc_checks($arg, $forced){ 
    4847                global $pearDB; 
     48                $actions = false;                
     49                $actions = verifyActionsACLofUser("host_checks_for_services"); 
     50                 
     51                if($actions == true) { 
    4952                $tab_forced = array("0" => "", "1" => "_FORCED"); 
    5053                $flg = write_command(" SCHEDULE".$tab_forced[$forced]."_HOST_SVC_CHECKS;" . $arg . ";" . time(), GetMyHostPoller($pearDB, $arg)); 
    5154                return $flg; 
     55                } 
     56                 
     57                return NULL; 
    5258        } 
    5359         
    5460        // SCHEDULE_SVC_CHECK 
    55          
    5661        function schedule_svc_checks($arg, $forced){ 
    5762                global $pearDB; 
     63                $actions = false;                
     64                $actions = verifyActionsACLofUser("service_checks"); 
     65                 
     66                if($actions == true) { 
    5867                $tab_forced = array("0" => "", "1" => "_FORCED"); 
    5968                $tab_data = split(";", $arg); 
    6069                $flg = write_command(" SCHEDULE".$tab_forced[$forced]."_SVC_CHECK;". $tab_data[0] . ";" . $tab_data[1] . ";" . time(), GetMyHostPoller($pearDB, $tab_data[0])); 
    6170                return _("Your command has been sent"); 
     71                } 
     72                 
     73                return NULL; 
    6274        } 
    6375         
    6476        // host check 
    65          
    6677        function host_check($arg, $type){ 
    6778                global $tab, $pearDB; 
     79                $actions = false;                
     80                $actions = verifyActionsACLofUser("host_checks"); 
     81                 
     82                if($actions == true) { 
    6883                $flg = write_command(" ". $tab[$type]."_HOST_CHECK;". $arg, GetMyHostPoller($pearDB, $arg)); 
    6984                return _("Your command has been sent"); 
     85                } 
     86                 
     87                return NULL; 
    7088        } 
    7189         
     
    7492        function host_notification($arg, $type){ 
    7593                global $tab, $pearDB; 
     94                $actions = false;                
     95                $actions = verifyActionsACLofUser("host_notifications"); 
     96                 
     97                if($actions == true) { 
    7698                $flg = write_command(" ".$tab[$type]."_HOST_NOTIFICATIONS;". $arg, GetMyHostPoller($pearDB, $arg)); 
    7799                return _("Your command has been sent"); 
     100                } 
     101                 
     102                return NULL; 
    78103        } 
    79104         
     
    82107        function host_svc_notifications($arg, $type){ 
    83108                global $tab, $pearDB; 
     109                $actions = false;                
     110                $actions = verifyActionsACLofUser("host_notifications_for_services"); 
     111                 
     112                if ($actions == true) { 
    84113                $flg = write_command(" " . $tab[$type] . "_HOST_SVC_NOTIFICATIONS;". $arg, GetMyHostPoller($pearDB, $arg)); 
    85114                return _("Your command has been sent"); 
     115                } 
     116                 
     117                return NULL; 
    86118        } 
    87119         
     
    90122        function host_svc_checks($arg, $type){ 
    91123                global $tab, $pearDB; 
    92                 $flg = write_command(" " . $tab[$type] . "_HOST_SVC_CHECKS;". $arg, GetMyHostPoller($pearDB, $arg)); 
    93                 return _("Your command has been sent"); 
     124                $actions = false;                
     125                $actions = verifyActionsACLofUser("host_checks_for_services"); 
     126                 
     127                if ($actions == true) { 
     128                        $flg = write_command(" " . $tab[$type] . "_HOST_SVC_CHECKS;". $arg, GetMyHostPoller($pearDB, $arg)); 
     129                        return _("Your command has been sent"); 
     130                } 
     131                 
     132                return NULL; 
    94133        } 
    95134         
     
    98137        function svc_check($arg, $type){ 
    99138                global $tab, $pearDB; 
    100                 $tab_data = split(";", $arg); 
    101                 $flg = write_command(" " . $tab[$type] . "_SVC_CHECK;". $tab_data["0"] .";".$tab_data["1"], GetMyHostPoller($pearDB, $tab_data["0"])); 
    102                 return _("Your command has been sent"); 
     139                $actions = false;                
     140                $actions = verifyActionsACLofUser("host_checks"); 
     141                 
     142                if ($actions == true) { 
     143                        $tab_data = split(";", $arg); 
     144                        $flg = write_command(" " . $tab[$type] . "_SVC_CHECK;". $tab_data["0"] .";".$tab_data["1"], GetMyHostPoller($pearDB, $tab_data["0"])); 
     145                        return _("Your command has been sent"); 
     146                } 
     147                 
     148                return NULL; 
    103149        } 
    104150         
     
    107153        function passive_svc_check($arg, $type){ 
    108154                global $pearDB,$tab; 
    109                 $tab_data = split(";", $arg); 
    110                 $flg = write_command(" " . $tab[$type] . "_PASSIVE_SVC_CHECKS;". $tab_data[0] . ";". $tab_data[1], GetMyHostPoller($pearDB, $tab_data["0"])); 
    111                 return _("Your command has been sent"); 
     155                $actions = false;                
     156                $actions = verifyActionsACLofUser("service_passive_checks"); 
     157                 
     158                if ($actions == true) { 
     159                        $tab_data = split(";", $arg); 
     160                        $flg = write_command(" " . $tab[$type] . "_PASSIVE_SVC_CHECKS;". $tab_data[0] . ";". $tab_data[1], GetMyHostPoller($pearDB, $tab_data["0"])); 
     161                        return _("Your command has been sent"); 
     162                } 
     163                 
     164                return NULL; 
    112165        } 
    113166         
     
    116169        function svc_notifications($arg, $type){ 
    117170                global $pearDB,$tab; 
    118                 $tab_data = split(";", $arg); 
    119                 $flg = write_command(" " . $tab[$type] . "_SVC_NOTIFICATIONS;". $tab_data[0] . ";". $tab_data[1], GetMyHostPoller($pearDB, $tab_data["0"])); 
    120                 return _("Your command has been sent"); 
     171                $actions = false;                
     172                $actions = verifyActionsACLofUser("service_notifications"); 
     173                 
     174                if ($actions == true) { 
     175                        $tab_data = split(";", $arg); 
     176                        $flg = write_command(" " . $tab[$type] . "_SVC_NOTIFICATIONS;". $tab_data[0] . ";". $tab_data[1], GetMyHostPoller($pearDB, $tab_data["0"])); 
     177                        return _("Your command has been sent"); 
     178                } 
     179                return NULL; 
    121180        } 
    122181         
     
    125184        function svc_event_handler($arg, $type){ 
    126185                global $pearDB,$tab; 
     186                $actions = false;                
     187                $actions = verifyActionsACLofUser("service_event_handler"); 
     188                 
     189                if($actions == true) { 
    127190                $tab_data = split(";", $arg); 
    128191                $flg = write_command(" " . $tab[$type] . "_SVC_EVENT_HANDLER;". $tab_data[0] .";".$tab_data[1], GetMyHostPoller($pearDB, $tab_data["0"])); 
    129192                return _("Your command has been sent"); 
     193                } 
     194                 
     195                return NULL; 
    130196        } 
    131197         
     
    134200        function host_event_handler($arg, $type){ 
    135201                global $pearDB,$tab; 
     202                $actions = false;                
     203                $actions = verifyActionsACLofUser("host_event_handler"); 
     204                 
     205                if($actions == true) { 
    136206                $tab_data = split(";", $arg); 
    137207                $flg = write_command(" " . $tab[$type] . "_HOST_EVENT_HANDLER;". $arg, GetMyHostPoller($pearDB, $arg)); 
    138208                return _("Your command has been sent"); 
     209                } 
     210                 
     211                return NULL; 
    139212        } 
    140213         
    141214        //_SVC_FLAP_DETECTION 
    142          
    143215        function svc_flapping_enable($arg, $type){ 
    144216                global $pearDB,$tab; 
     217                $actions = false;                
     218                $actions = verifyActionsACLofUser("service_flap_detection"); 
     219                 
     220                if($actions == true) { 
    145221                $tab_data = split(";", $arg); 
    146222                $flg = write_command(" " . $tab[$type] . "_SVC_FLAP_DETECTION;". $tab_data[0] .";".$tab_data[1], GetMyHostPoller($pearDB, $tab_data[0])); 
    147223                return _("Your command has been sent"); 
     224                } 
     225                return NULL; 
    148226        } 
    149227         
    150228        //_HOST_FLAP_DETECTION 
    151          
    152229        function host_flapping_enable($arg, $type){ 
    153230                global $pearDB,$tab; 
     231                $actions = false;                
     232                $actions = verifyActionsACLofUser("host_flap_detection"); 
     233                 
     234                if($actions == true) { 
    154235                $tab_data = split(";", $arg); 
    155236                $flg = write_command(" " . $tab[$type] . "_HOST_FLAP_DETECTION;". $arg, GetMyHostPoller($pearDB, $arg)); 
    156237                return _("Your command has been sent"); 
     238                } 
     239                 
     240                return NULL; 
    157241        } 
    158242         
     
    166250        function acknowledgeHost(){ 
    167251                global $pearDB,$tab, $_GET, $key; 
     252                $actions = false;                
     253                $actions = verifyActionsACLofUser("host_acknowledgement"); 
     254                 
     255                if ($actions == true) { 
    168256                $key = $_GET["host_name"]; 
    169257                $flg = write_command(" ACKNOWLEDGE_HOST_PROBLEM;".$_GET["host_name"].";1;".$_GET["notify"].";".$_GET["persistent"].";".$_GET["author"].";".$_GET["comment"], GetMyHostPoller($pearDB, $_GET["host_name"])); 
    170258                return _("Your command has been sent"); 
     259                } 
     260                 
     261                return NULL; 
    171262        } 
    172263         
    173264        function acknowledgeHostDisable(){ 
    174265                global $pearDB,$tab, $_GET; 
     266                $actions = false;                
     267                $actions = verifyActionsACLofUser("host_acknowledgement"); 
     268                 
     269                if ($actions == true) { 
    175270                $flg = write_command(" REMOVE_HOST_ACKNOWLEDGEMENT;".$_GET["host_name"], GetMyHostPoller($pearDB, $_GET["host_name"])); 
    176271                return _("Your command has been sent"); 
     272                } 
     273                 
     274                return NULL; 
    177275        } 
    178276         
    179277        function acknowledgeServiceDisable(){ 
    180278                global $pearDB,$tab; 
     279                $actions = false;                
     280                $actions = verifyActionsACLofUser("service_acknowledgement"); 
     281                 
     282                if ($actions == true) { 
    181283                $flg = write_command(" REMOVE_SVC_ACKNOWLEDGEMENT;".$_GET["host_name"].";".$_GET["service_description"], GetMyHostPoller($pearDB, $_GET["host_name"])); 
    182284                return _("Your command has been sent"); 
     285                } 
     286                 
     287                return NULL; 
    183288        } 
    184289 
    185290        function acknowledgeService(){ 
    186291                global $pearDB,$tab; 
     292                $actions = false; 
     293                $actions = verifyActionsACLofUser("service_acknowledgement"); 
     294                 
     295                if ($actions == true) { 
    187296                $_GET["comment"] = htmlentities($_GET["comment"]); 
    188297                $_GET["comment"] = str_replace('\'', ' ', $_GET["comment"]); 
    189298                $flg = write_command(" ACKNOWLEDGE_SVC_PROBLEM;".$_GET["host_name"].";".$_GET["service_description"].";1;".$_GET["notify"].";".$_GET["persistent"].";".$_GET["author"].";".$_GET["comment"], GetMyHostPoller($pearDB, $_GET["host_name"])); 
    190299                return _("Your command has been sent"); 
     300                } 
     301                 
     302                return NULL; 
    191303        } 
    192304 
    193305        function submitPassiveCheck(){ 
    194306                global $pearDB, $key; 
     307                $actions = false;                
     308                $actions = verifyActionsACLofUser("service_submit_result"); 
     309                 
     310                if ($actions == true) { 
    195311                $key = $_GET["host_name"]; 
    196312                $flg = write_command(" PROCESS_SERVICE_CHECK_RESULT;".$_GET["host_name"].";".$_GET["service_description"].";".$_GET["return_code"].";".$_GET["output"]."|".$_GET["dataPerform"], GetMyHostPoller($pearDB, $_GET["host_name"])); 
    197313                return _("Your command has been sent"); 
     314                } 
     315                 
     316                return NULL; 
    198317        } 
    199318