| 503 | } |
| 504 | |
| 505 | Value 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 | |
| 537 | void ClusterEvents::LastNotifiedStatePerUserUpdatedHandler(const Notification::Ptr& notification, const String& user, uint_fast8_t state, const MessageOrigin::Ptr& origin) |
| 538 | { |
nothing calls this directly
no test coverage detected