From 7419573df40b012641091a862c1020066327ae85 Mon Sep 17 00:00:00 2001 From: Maximilien Bersoult <mbersoult@centreon.com> Date: Fri, 30 Mar 2018 16:18:17 +0200 Subject: [PATCH] fix(api): Admin or not ? Use the database flag instead the is_admin --- tests/clapi_export/clapi-configuration.txt | 2 ++ www/api/class/webService.class.php | 2 +- www/class/centreon-clapi/centreonContact.class.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/clapi_export/clapi-configuration.txt b/tests/clapi_export/clapi-configuration.txt index c0f9518a4b..16cb14b6f9 100644 --- a/tests/clapi_export/clapi-configuration.txt +++ b/tests/clapi_export/clapi-configuration.txt @@ -714,6 +714,7 @@ CONTACTTPL;setparam;contact_template;servicenotifopt;n CONTACTTPL;setparam;contact_template;contact_js_effects;0 CONTACTTPL;setparam;contact_template;timezone; CONTACTTPL;setparam;contact_template;reach_api;0 +CONTACTTPL;setparam;contact_template;reach_api_rt;0 CONTACTTPL;setparam;contact_template;contact_enable_notifications;2 CONTACTTPL;setparam;contact_template;contact_type_msg;txt CONTACTTPL;setparam;contact_template;contact_activate;1 @@ -787,6 +788,7 @@ CONTACT;setparam;admin;servicenotifopt;n CONTACT;setparam;admin;contact_js_effects;0 CONTACT;setparam;admin;timezone; CONTACT;setparam;admin;reach_api;0 +CONTACT;setparam;admin;reach_api_rt;0 CONTACT;setparam;admin;contact_enable_notifications;1 CONTACT;setparam;admin;contact_type_msg;txt CONTACT;setparam;admin;contact_activate;1 diff --git a/www/api/class/webService.class.php b/www/api/class/webService.class.php index 255e929a69..aa10f8c34c 100644 --- a/www/api/class/webService.class.php +++ b/www/api/class/webService.class.php @@ -131,7 +131,7 @@ class CentreonWebService */ public function authorize($action, $user, $isInternal = false) { - if ($isInternal || $user->is_admin()) { + if ($isInternal || $user->admin) { return true; } diff --git a/www/class/centreon-clapi/centreonContact.class.php b/www/class/centreon-clapi/centreonContact.class.php index f20a9119c1..818048cde0 100644 --- a/www/class/centreon-clapi/centreonContact.class.php +++ b/www/class/centreon-clapi/centreonContact.class.php @@ -364,7 +364,7 @@ class CentreonContact extends CentreonObject } } } - if ($params[1] != 'reach_api' && $params[1] != 'default_page' && $params[1] != 'ar_id') { + if ($params[1] != 'reach_api' && $params[1] != 'reach_api_rt' && $params[1] != 'default_page' && $params[1] != 'ar_id') { $params[1] = "contact_" . $params[1]; } } -- GitLab