diff --git a/lang/fr/LC_MESSAGES/messages.po b/lang/fr/LC_MESSAGES/messages.po index 120e669974f..142e748c5a8 100644 --- a/lang/fr/LC_MESSAGES/messages.po +++ b/lang/fr/LC_MESSAGES/messages.po @@ -14690,3 +14690,9 @@ msgstr "Certains collecteurs ne sont pas à jour en base de données; vérifiez msgid "Latency detected, check configuration for better optimization" msgstr "Latence détectée, vérifiez la configuration pour une meilleure optimisation" + +msgid "You can't edit this downtime because you don't have access to all of its resources" +msgstr "Vous ne pouvez pas éditer ce temps d’arrêt car vous n'êtes pas autorisé à accéder à toutes les ressources liées" + +msgid "You can't edit this hostgroup because you don't have access to all its resources" +msgstr "Vous ne pouvez pas éditer groupe d'hote car vous n'êtes pas autorisé à accéder à toutes les ressources liées" diff --git a/www/include/configuration/configObject/hostgroup/formHostGroup.ihtml b/www/include/configuration/configObject/hostgroup/formHostGroup.ihtml index f0af2b97481..447e6ccf1d4 100644 --- a/www/include/configuration/configObject/hostgroup/formHostGroup.ihtml +++ b/www/include/configuration/configObject/hostgroup/formHostGroup.ihtml @@ -1,66 +1,119 @@ {$form.javascript}{$javascript}
{$helptext} diff --git a/www/include/configuration/configObject/hostgroup/formHostGroup.php b/www/include/configuration/configObject/hostgroup/formHostGroup.php index f5720077173..eb39e5dd565 100644 --- a/www/include/configuration/configObject/hostgroup/formHostGroup.php +++ b/www/include/configuration/configObject/hostgroup/formHostGroup.php @@ -37,7 +37,7 @@ exit(); } -if (!$oreon->user->admin) { +if (!$centreon->user->admin) { if ($hg_id && false === strpos($hgString, "'" . $hg_id . "'")) { $msg = new CentreonMsg(); $msg->setImage("./img/icons/warning.png"); @@ -212,12 +212,27 @@ function myReplace() $form->setDefaults($hg); $form->freeze(); } elseif ($o == "c") { - /* - * Modify a HostGroup information - */ + //Modify a HostGroup information $subC = $form->addElement('submit', 'submitC', _("Save"), array("class" => "btc bt_success")); $res = $form->addElement('reset', 'reset', _("Reset"), array("class" => "btc bt_default")); $form->setDefaults($hg); + + //check host resources + $hostArray = array(); + $host = $acl->getHostAclConf(null, 'broker'); + $accessHost = array_keys($host); + $rq = "SELECT DISTINCT h.host_id FROM hostgroup_relation hgr, host h " . + " WHERE hostgroup_hg_id = '" . $hg_id . "' AND h.host_id = hgr.host_host_id AND h.host_register = '1' "; + $db = $pearDB->query($rq); + while ($row = $db->fetch()) { + $hostArray[] = $row['host_id']; + } + $result = array_diff($hostArray, $accessHost); + if (!empty($result) && (!$centreon->user->admin)) { + $form->addElement('text', 'msgacl', _("error"), 'error'); + $form->freeze(); + } + } elseif ($o == "a") { /* * Add a HostGroup information diff --git a/www/include/configuration/configObject/hostgroup/hostGroup.php b/www/include/configuration/configObject/hostgroup/hostGroup.php index 7279b3e76c1..9596d1d3038 100644 --- a/www/include/configuration/configObject/hostgroup/hostGroup.php +++ b/www/include/configuration/configObject/hostgroup/hostGroup.php @@ -39,7 +39,7 @@ isset($_GET["hg_id"]) ? $hG = $_GET["hg_id"] : $hG = null; isset($_POST["hg_id"]) ? $hP = $_POST["hg_id"] : $hP = null; -$hG ? $hg_id = $hG : $hg_id = $hP; +$hG ? $hg_id = (int)$hG : $hg_id = (int)$hP; isset($_GET["select"]) ? $cG = $_GET["select"] : $cG = null; isset($_POST["select"]) ? $cP = $_POST["select"] : $cP = null; diff --git a/www/include/monitoring/recurrentDowntime/formDowntime.html b/www/include/monitoring/recurrentDowntime/formDowntime.html index daea361b064..70015d5b446 100644 --- a/www/include/monitoring/recurrentDowntime/formDowntime.html +++ b/www/include/monitoring/recurrentDowntime/formDowntime.html @@ -235,21 +235,31 @@ } {/literal} + + +{if $form.msgacl } +