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

Method SendNotificationUserGroupsChanged

lib/icingadb/icingadb-objects.cpp:2650–2670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2648}
2649
2650void IcingaDB::SendNotificationUserGroupsChanged(const Notification::Ptr& notification, const Array::Ptr& oldValues, const Array::Ptr& newValues) {
2651 if (!m_RconWorker || !m_RconWorker->IsConnected() || oldValues == newValues) {
2652 return;
2653 }
2654
2655 std::vector<Value> deletedUserGroups = GetArrayDeletedValues(oldValues, newValues);
2656
2657 for (const auto& userGroupName : deletedUserGroups) {
2658 UserGroup::Ptr userGroup = UserGroup::GetByName(userGroupName);
2659 String id = HashValue(new Array({m_EnvironmentId, "usergroup", userGroupName, notification->GetName()}));
2660 EnqueueRelationsDeletion(id, {
2661 {CONFIG_REDIS_KEY_PREFIX "notification:usergroup", ""},
2662 {CONFIG_REDIS_KEY_PREFIX "notification:recipient", ""}
2663 });
2664
2665 for (const User::Ptr& user : userGroup->GetMembers()) {
2666 String userId = HashValue(new Array({m_EnvironmentId, "usergroupuser", user->GetName(), userGroupName, notification->GetName()}));
2667 EnqueueRelationsDeletion(userId, {{CONFIG_REDIS_KEY_PREFIX "notification:recipient", ""}});
2668 }
2669 }
2670}
2671
2672void IcingaDB::SendTimePeriodRangesChanged(const TimePeriod::Ptr& timeperiod, const Dictionary::Ptr& oldValues, const Dictionary::Ptr& newValues) {
2673 if (!m_RconWorker || !m_RconWorker->IsConnected() || oldValues == newValues) {

Calls 3

IsConnectedMethod · 0.80
GetNameMethod · 0.45
GetMembersMethod · 0.45

Tested by

no test coverage detected