| 875 | } |
| 876 | |
| 877 | Value ClusterEvents::AcknowledgementClearedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params) |
| 878 | { |
| 879 | Endpoint::Ptr endpoint = origin->FromClient->GetEndpoint(); |
| 880 | |
| 881 | if (!endpoint) { |
| 882 | Log(LogNotice, "ClusterEvents") |
| 883 | << "Discarding 'acknowledgement cleared' message from '" << origin->FromClient->GetIdentity() << "': Invalid endpoint origin (client not allowed)."; |
| 884 | return Empty; |
| 885 | } |
| 886 | |
| 887 | Host::Ptr host = Host::GetByName(params->Get("host")); |
| 888 | |
| 889 | if (!host) |
| 890 | return Empty; |
| 891 | |
| 892 | Checkable::Ptr checkable; |
| 893 | |
| 894 | if (params->Contains("service")) |
| 895 | checkable = host->GetServiceByShortName(params->Get("service")); |
| 896 | else |
| 897 | checkable = host; |
| 898 | |
| 899 | if (!checkable) |
| 900 | return Empty; |
| 901 | |
| 902 | if (origin->FromZone && !origin->FromZone->CanAccessObject(checkable)) { |
| 903 | Log(LogNotice, "ClusterEvents") |
| 904 | << "Discarding 'acknowledgement cleared' message for checkable '" << checkable->GetName() |
| 905 | << "' from '" << origin->FromClient->GetIdentity() << "': Unauthorized access."; |
| 906 | return Empty; |
| 907 | } |
| 908 | |
| 909 | checkable->ClearAcknowledgement(params->Get("author"), params->Get("change_time"), origin); |
| 910 | |
| 911 | return Empty; |
| 912 | } |
| 913 | |
| 914 | Value ClusterEvents::ExecuteCommandAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params) |
| 915 | { |
nothing calls this directly
no test coverage detected