MCPcopy Create free account
hub / github.com/Icinga/icinga2 / NextNotificationChangedAPIHandler

Method NextNotificationChangedAPIHandler

lib/icinga/clusterevents.cpp:505–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503}
504
505Value ClusterEvents::NextNotificationChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
506{
507 Endpoint::Ptr endpoint = origin->FromClient->GetEndpoint();
508
509 if (!endpoint) {
510 Log(LogNotice, "ClusterEvents")
511 << "Discarding 'next notification changed' message from '" << origin->FromClient->GetIdentity() << "': Invalid endpoint origin (client not allowed).";
512 return Empty;
513 }
514
515 Notification::Ptr notification = Notification::GetByName(params->Get("notification"));
516
517 if (!notification)
518 return Empty;
519
520 if (origin->FromZone && !origin->FromZone->CanAccessObject(notification)) {
521 Log(LogNotice, "ClusterEvents")
522 << "Discarding 'next notification changed' message for notification '" << notification->GetName()
523 << "' from '" << origin->FromClient->GetIdentity() << "': Unauthorized access.";
524 return Empty;
525 }
526
527 double nextNotification = params->Get("next_notification");
528
529 if (nextNotification < Utility::GetTime())
530 return Empty;
531
532 notification->SetNextNotification(nextNotification, false, origin);
533
534 return Empty;
535}
536
537void ClusterEvents::LastNotifiedStatePerUserUpdatedHandler(const Notification::Ptr& notification, const String& user, uint_fast8_t state, const MessageOrigin::Ptr& origin)
538{

Callers

nothing calls this directly

Calls 6

LogClass · 0.85
GetEndpointMethod · 0.80
GetIdentityMethod · 0.80
CanAccessObjectMethod · 0.80
GetMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected