| 401 | } |
| 402 | |
| 403 | Value ClusterEvents::SuppressedNotificationsChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params) |
| 404 | { |
| 405 | Endpoint::Ptr endpoint = origin->FromClient->GetEndpoint(); |
| 406 | |
| 407 | if (!endpoint) { |
| 408 | Log(LogNotice, "ClusterEvents") |
| 409 | << "Discarding 'suppressed notifications changed' message from '" << origin->FromClient->GetIdentity() << "': Invalid endpoint origin (client not allowed)."; |
| 410 | return Empty; |
| 411 | } |
| 412 | |
| 413 | Host::Ptr host = Host::GetByName(params->Get("host")); |
| 414 | |
| 415 | if (!host) |
| 416 | return Empty; |
| 417 | |
| 418 | Checkable::Ptr checkable; |
| 419 | |
| 420 | if (params->Contains("service")) |
| 421 | checkable = host->GetServiceByShortName(params->Get("service")); |
| 422 | else |
| 423 | checkable = host; |
| 424 | |
| 425 | if (!checkable) |
| 426 | return Empty; |
| 427 | |
| 428 | if (origin->FromZone && origin->FromZone != Zone::GetLocalZone()) { |
| 429 | Log(LogNotice, "ClusterEvents") |
| 430 | << "Discarding 'suppressed notifications changed' message for checkable '" << checkable->GetName() |
| 431 | << "' from '" << origin->FromClient->GetIdentity() << "': Unauthorized access."; |
| 432 | return Empty; |
| 433 | } |
| 434 | |
| 435 | checkable->SetSuppressedNotifications(params->Get("suppressed_notifications"), false, origin); |
| 436 | |
| 437 | return Empty; |
| 438 | } |
| 439 | |
| 440 | void ClusterEvents::SuppressedNotificationTypesChangedHandler(const Notification::Ptr& notification, const MessageOrigin::Ptr& origin) |
| 441 | { |
nothing calls this directly
no test coverage detected