Commit e90e188f authored by loiclau's avatar loiclau

fix(downtime) fix host group and poller with acl (#6023)

* fix(downtime) fix host group with acl

* fix(downtime) fix poller with acl
parent 38ba6e3e
......@@ -49,6 +49,7 @@ include_once _CENTREON_PATH_ . "www/class/centreonHost.class.php";
$centreonGMT = new CentreonGMT($pearDB);
$centreonGMT->getMyGMTFromSession(session_id(), $pearDB);
$hostStr = $centreon->user->access->getHostsString("ID", $pearDBO);
$host_acl_id = preg_split('/,/', str_replace("'", "", $hostStr));
$hObj = new CentreonHost($pearDB);
$serviceObj = new CentreonService($pearDB);
......@@ -356,7 +357,6 @@ if (!$centreon->user->access->checkAction("host_schedule_downtime")
$hg = new CentreonHostgroups($pearDB);
foreach ($_POST['hostgroup_id'] as $hg_id) {
$hostlist = $hg->getHostGroupHosts($hg_id);
$host_acl_id = preg_split('/,/', str_replace("'", "", $hostStr));
foreach ($hostlist as $host_id) {
if ($centreon->user->access->admin || in_array($host_id, $host_acl_id)) {
$ecObj->addHostDowntime(
......@@ -422,10 +422,9 @@ if (!$centreon->user->access->checkAction("host_schedule_downtime")
* Set a downtime for poller
*/
foreach ($_POST['poller_id'] as $poller_id) {
$host_id = preg_split('/,/', str_replace("'", "", $hostStr));
$DBRESULT = $pearDBO->query("SELECT host_id FROM hosts WHERE instance_id = $poller_id AND enabled = 1");
while ($row = $DBRESULT->fetchRow()) {
if ($centreon->user->access->admin || isset($host_acl_id[$host_id])) {
if ($centreon->user->access->admin || in_array($row['host_id'], $host_acl_id)) {
$ecObj->addHostDowntime(
$row['host_id'],
$_POST["comment"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment