| 669 | } |
| 670 | |
| 671 | Value ClusterEvents::ForceNextCheckChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params) |
| 672 | { |
| 673 | Endpoint::Ptr endpoint = origin->FromClient->GetEndpoint(); |
| 674 | |
| 675 | if (!endpoint) { |
| 676 | Log(LogNotice, "ClusterEvents") |
| 677 | << "Discarding 'force next check changed' message from '" << origin->FromClient->GetIdentity() << "': Invalid endpoint origin (client not allowed)."; |
| 678 | return Empty; |
| 679 | } |
| 680 | |
| 681 | Host::Ptr host = Host::GetByName(params->Get("host")); |
| 682 | |
| 683 | if (!host) |
| 684 | return Empty; |
| 685 | |
| 686 | Checkable::Ptr checkable; |
| 687 | |
| 688 | if (params->Contains("service")) |
| 689 | checkable = host->GetServiceByShortName(params->Get("service")); |
| 690 | else |
| 691 | checkable = host; |
| 692 | |
| 693 | if (!checkable) |
| 694 | return Empty; |
| 695 | |
| 696 | if (origin->FromZone && !origin->FromZone->CanAccessObject(checkable)) { |
| 697 | Log(LogNotice, "ClusterEvents") |
| 698 | << "Discarding 'force next check' message for checkable '" << checkable->GetName() |
| 699 | << "' from '" << origin->FromClient->GetIdentity() << "': Unauthorized access."; |
| 700 | return Empty; |
| 701 | } |
| 702 | |
| 703 | checkable->SetForceNextCheck(params->Get("forced"), false, origin); |
| 704 | |
| 705 | return Empty; |
| 706 | } |
| 707 | |
| 708 | void ClusterEvents::ForceNextNotificationChangedHandler(const Checkable::Ptr& checkable, const MessageOrigin::Ptr& origin) |
| 709 | { |
nothing calls this directly
no test coverage detected