From 1afb47228f7e0b7749801e5d1853463082bd5dd9 Mon Sep 17 00:00:00 2001 From: alaunois Date: Fri, 17 Jun 2022 14:23:29 +0200 Subject: [PATCH] enh(acl) add poller access acl config (#11235) * enh(acl) add poller access acl config * add help tip and translation * fix update, adapt poller list page buttons * fix translate * apply suggestion * Apply suggestions from code review Co-authored-by: smau <102975713+smau-centreon@users.noreply.github.com> * Update lang/fr_FR.UTF-8/LC_MESSAGES/help.po Co-authored-by: Kevin Duret * Update lang/fr_FR.UTF-8/LC_MESSAGES/help.po Co-authored-by: Kevin Duret * Update lang/fr_FR.UTF-8/LC_MESSAGES/help.po Co-authored-by: Kevin Duret Co-authored-by: smau <102975713+smau-centreon@users.noreply.github.com> Co-authored-by: Kevin Duret --- lang/es_ES.UTF-8/LC_MESSAGES/help.po | 23 ++++++++++- lang/fr_FR.UTF-8/LC_MESSAGES/help.po | 21 ++++++++++ lang/pt_BR.UTF-8/LC_MESSAGES/help.po | 22 +++++++++++ lang/pt_PT.UTF-8/LC_MESSAGES/help.po | 23 ++++++++++- .../configServers/listServers.ihtml | 20 ++++++---- .../configServers/listServers.php | 14 +++---- .../accessLists/actionsACL/DB-Func.php | 2 + .../actionsACL/formActionsAccess.ihtml | 39 +++++++++++++------ .../actionsACL/formActionsAccess.php | 5 ++- .../options/accessLists/actionsACL/help.php | 14 +++++-- 10 files changed, 149 insertions(+), 34 deletions(-) diff --git a/lang/es_ES.UTF-8/LC_MESSAGES/help.po b/lang/es_ES.UTF-8/LC_MESSAGES/help.po index 28c3a9db6f2..eb26d0e1b80 100644 --- a/lang/es_ES.UTF-8/LC_MESSAGES/help.po +++ b/lang/es_ES.UTF-8/LC_MESSAGES/help.po @@ -4304,4 +4304,25 @@ msgstr "Ejecuta el comando definido en la configuración del recopilador (Config #~ msgstr "" #~ msgid "Additional Remote Server to which this server will be attached" -#~ msgstr "" \ No newline at end of file +#~ msgstr "" + +# msgid "Create and edit pollers" +# msgstr "" + +# msgid "Delete pollers" +# msgstr "" + +# msgid "Deploy configuration" +# msgstr "" + +# msgid "Poller Configuration Actions / Poller Management" +# msgstr "" + +# msgid "Allows user to perform “Add”, “Add (advanced)” and “Duplicate” actions on pollers." +# msgstr "" + +# msgid "Allows user to delete pollers." +# msgstr "" + +# msgid "Allows user to deploy configuration." +# msgstr "" diff --git a/lang/fr_FR.UTF-8/LC_MESSAGES/help.po b/lang/fr_FR.UTF-8/LC_MESSAGES/help.po index f4ff2705a8b..5e0a4fb2f34 100644 --- a/lang/fr_FR.UTF-8/LC_MESSAGES/help.po +++ b/lang/fr_FR.UTF-8/LC_MESSAGES/help.po @@ -7219,3 +7219,24 @@ msgid "Mode used to retrieve information displayed in Resource Status page." "The optimized mode will only be available and functional when using the BBDO 3.0.0 protocol for the collect engine." msgstr "Mode utilisé pour récupérer les données affichées dans la page Resource Status." "Le mode optimisé pourra être utilisé et fonctionnel que si le moteur de supervision utilise le protocole BBDO 3.0.0" + +msgid "Poller Configuration Actions / Poller Management" +msgstr "Actions de configuration du collecteur / Gestion du collecteur" + +msgid "Create and edit pollers" +msgstr "Créer et modifier des collecteurs" + +msgid "Delete pollers" +msgstr "Supprimer des collecteurs" + +msgid "Deploy configuration" +msgstr "Déployer la configuration" + +msgid "Allows user to perform “Add”, “Add (advanced)” and “Duplicate” actions on pollers." +msgstr "Permet à l'utilisateur de créer des collecteurs (boutons Ajouter, Ajouter (avancé) et Dupliquer)." + +msgid "Allows user to delete pollers." +msgstr "Permet à l'utilisateur de supprimer des collecteurs." + +msgid "Allows user to deploy configuration." +msgstr "Permet à l'utilisateur de déployer la configuration." diff --git a/lang/pt_BR.UTF-8/LC_MESSAGES/help.po b/lang/pt_BR.UTF-8/LC_MESSAGES/help.po index 9c3e863f674..b465d85522e 100644 --- a/lang/pt_BR.UTF-8/LC_MESSAGES/help.po +++ b/lang/pt_BR.UTF-8/LC_MESSAGES/help.po @@ -6655,3 +6655,25 @@ msgstr "" #~ msgid "Additional Remote Server to which this server will be attached" #~ msgstr "" + + +# msgid "Poller Configuration Actions / Poller Management" +# msgstr "" + +# msgid "Create and edit pollers" +# msgstr "" + +# msgid "Delete pollers" +# msgstr "" + +# msgid "Deploy configuration" +# msgstr "" + +# msgid "Allows user to perform “Add”, “Add (advanced)” and “Duplicate” actions on pollers." +# msgstr "" + +# msgid "Allows user to delete pollers." +# msgstr "" + +# msgid "Allows user to deploy configuration." +# msgstr "" diff --git a/lang/pt_PT.UTF-8/LC_MESSAGES/help.po b/lang/pt_PT.UTF-8/LC_MESSAGES/help.po index 663f580dcea..40a383e9687 100644 --- a/lang/pt_PT.UTF-8/LC_MESSAGES/help.po +++ b/lang/pt_PT.UTF-8/LC_MESSAGES/help.po @@ -4774,4 +4774,25 @@ msgstr "" # msgid "" # msgid "Disacknowledgement command sent" -# msgid "" \ No newline at end of file +# msgid "" + +# msgid "Poller Configuration Actions / Poller Management" +# msgstr "" + +# msgid "Create and edit pollers" +# msgstr "" + +# msgid "Delete pollers" +# msgstr "" + +# msgid "Deploy configuration" +# msgstr "" + +# msgid "Allows user to perform “Add”, “Add (advanced)” and “Duplicate” actions on pollers." +# msgstr "" + +# msgid "Allows user to delete pollers." +# msgstr "" + +# msgid "Allows user to deploy configuration." +# msgstr "" diff --git a/www/include/configuration/configServers/listServers.ihtml b/www/include/configuration/configServers/listServers.ihtml index bb116548e8b..65aa23847ae 100644 --- a/www/include/configuration/configServers/listServers.ihtml +++ b/www/include/configuration/configServers/listServers.ihtml @@ -50,7 +50,7 @@ {if !$isRemote} - {if $mode_access == 'w'} + {if $mode_access == 'w' && $can_create_edit == 1} {$wizardAddBtn.icon} {$wizardAddBtn.text} @@ -58,19 +58,23 @@ {$addBtn.icon} {$addBtn.text} {/if} - {if $is_admin == 1 || $can_generate == 1} + {if $can_generate == 1} {/if} {if $mode_access == 'w'} - - + {if $can_create_edit == 1} + + {/if} + {if $can_delete == 1} + + {/if} {/if} {/if} diff --git a/www/include/configuration/configServers/listServers.php b/www/include/configuration/configServers/listServers.php index 67adf348904..c0cd0a65b69 100644 --- a/www/include/configuration/configServers/listServers.php +++ b/www/include/configuration/configServers/listServers.php @@ -65,15 +65,9 @@ } // Get Authorized Actions -if ($is_admin == 0) { - if ($centreon->user->access->checkAction('generate_cfg')) { - $can_generate = 1; - } else { - $can_generate = 0; - } -} else { - $can_generate = 0; -} +$can_generate = $centreon->user->access->checkAction('generate_cfg'); +$can_create_edit = $centreon->user->access->checkAction('create_edit_poller_cfg'); +$can_delete = $centreon->user->access->checkAction('delete_poller_cfg'); /* * nagios servers comes from DB @@ -382,6 +376,8 @@ $tpl->assign('limit', $limit); $tpl->assign('searchP', $search); $tpl->assign("can_generate", $can_generate); +$tpl->assign("can_create_edit", $can_create_edit); +$tpl->assign("can_delete", $can_delete); $tpl->assign("is_admin", $is_admin); $tpl->assign("isRemote", $isRemote); diff --git a/www/include/options/accessLists/actionsACL/DB-Func.php b/www/include/options/accessLists/actionsACL/DB-Func.php index 10151912b7c..70530db48ec 100644 --- a/www/include/options/accessLists/actionsACL/DB-Func.php +++ b/www/include/options/accessLists/actionsACL/DB-Func.php @@ -411,6 +411,8 @@ function listActions() $actions[] = "global_host_obsess"; $actions[] = "global_perf_data"; + $actions[] = "create_edit_poller_cfg"; + $actions[] = "delete_poller_cfg"; $actions[] = "generate_cfg"; $actions[] = "generate_trap"; diff --git a/www/include/options/accessLists/actionsACL/formActionsAccess.ihtml b/www/include/options/accessLists/actionsACL/formActionsAccess.ihtml index 0ddd7005ce0..233dda40acf 100644 --- a/www/include/options/accessLists/actionsACL/formActionsAccess.ihtml +++ b/www/include/options/accessLists/actionsACL/formActionsAccess.ihtml @@ -19,7 +19,7 @@

| {$form.header.title}

- +

{$form.header.information}

@@ -34,7 +34,7 @@ {$form.acl_groups.label}

{$form.acl_groups.html}

- + @@ -48,12 +48,29 @@ -

{t}Configuration Actions{/t}

+

{$form.header.poller_cfg_access}

- {$form.generate_cfg.label}

{$form.generate_cfg.html}

+ + {$form.create_edit_poller_cfg.label} + +

{$form.create_edit_poller_cfg.html}

+ + + + {$form.delete_poller_cfg.label} + +

{$form.delete_poller_cfg.html}

+ + + + {$form.generate_cfg.label} + +

{$form.generate_cfg.html}

+ + {$form.generate_trap.label}

{$form.generate_trap.html}

- + @@ -75,7 +92,7 @@ {$form.global_service_obsess.label}

{$form.global_service_obsess.html}

{$form.global_host_obsess.label}

{$form.global_host_obsess.html}

{$form.global_perf_data.label}

{$form.global_perf_data.html}

- + @@ -102,7 +119,7 @@ {/if} {$form.service_submit_result.label}

{$form.service_submit_result.html}

{$form.service_display_command.label}

{$form.service_display_command.html}

- + @@ -117,9 +134,9 @@ {$form.host_notifications.label}

{$form.host_notifications.html}

{/if} {$form.host_acknowledgement.label}

{$form.host_acknowledgement.html}

- {$form.host_disacknowledgement.label}

{$form.host_disacknowledgement.html}

- {$form.host_schedule_check.label}

{$form.host_schedule_check.html}

- {$form.host_schedule_forced_check.label}

{$form.host_schedule_forced_check.html}

+ {$form.host_disacknowledgement.label}

{$form.host_disacknowledgement.html}

+ {$form.host_schedule_check.label}

{$form.host_schedule_check.html}

+ {$form.host_schedule_forced_check.label}

{$form.host_schedule_forced_check.html}

{$form.host_schedule_downtime.label}

{$form.host_schedule_downtime.html}

{$form.host_comment.label}

{$form.host_comment.html}

{if $serverIsMaster} @@ -136,7 +153,7 @@ {$form.acl_action_activate.label}{$form.acl_action_activate.html} - + {if $o == "a" || $o == "c"} {if isset($form.required)} diff --git a/www/include/options/accessLists/actionsACL/formActionsAccess.php b/www/include/options/accessLists/actionsACL/formActionsAccess.php index 0efddb0595b..1a48e50de5f 100644 --- a/www/include/options/accessLists/actionsACL/formActionsAccess.php +++ b/www/include/options/accessLists/actionsACL/formActionsAccess.php @@ -173,7 +173,9 @@ $form->addElement('checkbox', 'poller_listing', _("Display Poller Listing")); // Configuration Actions -$form->addElement('checkbox', 'generate_cfg', _("Generate Configuration Files")); +$form->addElement('checkbox', 'create_edit_poller_cfg', _("Create and edit pollers")); +$form->addElement('checkbox', 'delete_poller_cfg', _("Delete pollers")); +$form->addElement('checkbox', 'generate_cfg', _("Deploy configuration Files")); $form->addElement('checkbox', 'generate_trap', _("Generate SNMP Trap configuration")); $form->addElement('checkbox', 'all_service', ""); @@ -189,6 +191,7 @@ $form->addElement('header', 'host_actions', _("Hosts Actions Access")); $form->addElement('header', 'global_actions', _("Global Monitoring Engine Actions (External Process Commands)")); $form->addElement('header', 'global_access', _("Global Functionalities Access")); +$form->addElement('header', 'poller_cfg_access', _("Poller Configuration Actions / Poller Management")); $ams1 = $form->addElement('advmultiselect', 'acl_groups', _("Linked Groups"), $groups, $attrsAdvSelect, SORT_ASC); $ams1->setButtonAttributes('add', array('value' => _("Add"), "class" => "btc bt_success")); diff --git a/www/include/options/accessLists/actionsACL/help.php b/www/include/options/accessLists/actionsACL/help.php index adc5ec7c194..21160fa42f2 100644 --- a/www/include/options/accessLists/actionsACL/help.php +++ b/www/include/options/accessLists/actionsACL/help.php @@ -32,11 +32,19 @@ ); /** - * Generation of files + * Poller configuration - Generation of configuration files */ -$help['tip_display_generate_cfg'] = dgettext( +$help['create_edit_pollers'] = dgettext( 'help', - 'Allows user to generate and export configuration, and restart poller.' + 'Allows user to perform “Add”, “Add (advanced)” and “Duplicate” actions on pollers.' +); +$help['delete_pollers'] = dgettext( + 'help', + 'Allows user to delete pollers.' +); +$help['deploy_pollers'] = dgettext( + 'help', + 'Allows user to deploy configuration.' ); $help['tip_display_generate_trap'] = dgettext( 'help',