Esempio n. 1
0
 /**
  * @param CentreonMain\Events\PostSave $event
  */
 public static function execute(PostSaveEvent $event)
 {
     $parameters = $event->getParameters();
     $extraParameters = $event->getExtraParameters();
     if (isset($extraParameters['centreon-engine'])) {
         if ($event->getObjectName() === 'poller') {
             if (isset($extraParameters['centreon-engine'])) {
                 EngineRepository::save($event->getObjectId(), $extraParameters['centreon-engine'], "form");
             }
         }
     }
 }
Esempio n. 2
0
 /**
  * @param CentreonMain\Events\PostSave $event
  */
 public static function execute(PostSaveEvent $event)
 {
     $parameters = $event->getParameters();
     $extraParameters = $event->getExtraParameters();
     if ($event->getObjectName() === 'poller') {
         foreach ($parameters as $key => $value) {
             $extraParameters['centreon-broker'][$key] = $value;
         }
         if ($event->getAction() === 'update' && !isset($extraParameters['centreon-broker']['tmpl_name'])) {
             $templateName = Poller::getParameters($extraParameters['centreon-broker']['object_id'], 'tmpl_name');
             $extraParameters['centreon-broker']['tmpl_name'] = $templateName['tmpl_name'];
         }
         BrokerRepository::save($event->getObjectId(), $extraParameters['centreon-broker']);
     }
 }
Esempio n. 3
0
 /**
  * @param CentreonMain\Events\PostSave $event
  */
 public static function execute(PostSaveEvent $event)
 {
     $parameters = $event->getParameters();
     $extraParameters = $event->getExtraParameters();
     if (isset($extraParameters['centreon-configuration'])) {
         if ($event->getObjectName() === 'aclresource') {
             if (isset($extraParameters['centreon-configuration']['aclresource_hosts'])) {
                 $hostIds = array_filter(array_map('trim', explode(',', $extraParameters['centreon-configuration']['aclresource_hosts'])));
                 HostRepository::updateHostAcl($event->getAction(), $event->getObjectId(), $hostIds);
             }
             if (isset($extraParameters['centreon-configuration']['aclresource_host_tags'])) {
                 $hostTagIds = array_filter(array_map('trim', explode(',', $extraParameters['centreon-configuration']['aclresource_host_tags'])));
                 HostTagRepository::updateHostTagAcl($event->getAction(), $event->getObjectId(), $hostTagIds);
             }
             if (isset($extraParameters['centreon-configuration']['aclresource_services'])) {
                 $serviceIds = array_filter(array_map('trim', explode(',', $extraParameters['centreon-configuration']['aclresource_services'])));
                 ServiceRepository::updateServiceAcl($event->getAction(), $event->getObjectId(), $serviceIds);
             }
             if (isset($extraParameters['centreon-configuration']['aclresource_service_tags'])) {
                 $serviceTagIds = array_filter(array_map('trim', explode(',', $extraParameters['centreon-configuration']['aclresource_service_tags'])));
                 ServiceTagRepository::updateServiceTagAcl($event->getAction(), $event->getObjectId(), $serviceTagIds);
             }
             if (isset($extraParameters['centreon-configuration']['aclresource_all_hosts'])) {
                 $allHosts = $extraParameters['centreon-configuration']['aclresource_all_hosts'];
                 HostRepository::updateAllHostsAcl($event->getAction(), $event->getObjectId(), $allHosts);
             } else {
                 HostRepository::updateAllHostsAcl($event->getAction(), $event->getObjectId(), '0');
             }
         }
     }
 }
Esempio n. 4
0
 /**
  * @param CentreonMain\Events\PostSave $event
  */
 public static function execute(PostSaveEvent $event)
 {
     $parameters = $event->getParameters();
     $extraParameters = $event->getExtraParameters();
     if (isset($extraParameters['centreon-bam'])) {
         if ($event->getObjectName() === 'aclresource') {
             if (isset($extraParameters['centreon-bam']['aclresource_business_activities'])) {
                 $baIds = array_filter(array_map('trim', explode(',', $extraParameters['centreon-bam']['aclresource_business_activities'])));
                 BusinessActivityRepository::updateBusinessActivityAcl($event->getAction(), $event->getObjectId(), $baIds);
             }
             if (isset($extraParameters['centreon-bam']['aclresource_business_activity_tags'])) {
                 $baTagIds = array_filter(array_map('trim', explode(',', $extraParameters['centreon-bam']['aclresource_business_activity_tags'])));
                 BusinessActivityTagRepository::updateBusinessActivityTagAcl($event->getAction(), $event->getObjectId(), $baTagIds);
             }
             if (isset($extraParameters['centreon-bam']['aclresource_all_bas'])) {
                 $allBas = $extraParameters['centreon-bam']['aclresource_all_bas'];
                 BusinessActivityRepository::updateAllBusinessActivitiesAcl($event->getAction(), $event->getObjectId(), $allBas);
             } else {
                 BusinessActivityRepository::updateAllBusinessActivitiesAcl($event->getAction(), $event->getObjectId(), '0');
             }
         }
     }
 }