From e456cfd99ce2e40a4c07475447b821e056b94e4f Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sun, 8 Feb 2015 11:03:10 +0100 Subject: [PATCH] Relax the validator for Notification::users/Notification::user_groups a bit fixes #8067 --- lib/icinga/notification.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/icinga/notification.cpp b/lib/icinga/notification.cpp index 4e86dfec8..eecf23559 100644 --- a/lib/icinga/notification.cpp +++ b/lib/icinga/notification.cpp @@ -503,17 +503,10 @@ int icinga::FilterArrayToInt(const Array::Ptr& typeFilters, int defaultValue) void Notification::ValidateUsers(const String& location, const Notification::Ptr& object) { - std::set allUsers; - - std::set users = object->GetUsers(); - std::copy(users.begin(), users.end(), std::inserter(allUsers, allUsers.begin())); - - BOOST_FOREACH(const UserGroup::Ptr& ug, object->GetUserGroups()) { - std::set members = ug->GetMembers(); - std::copy(members.begin(), members.end(), std::inserter(allUsers, allUsers.begin())); - } + Array::Ptr users = object->GetUsersRaw(); + Array::Ptr groups = object->GetUserGroupsRaw(); - if (allUsers.empty()) { + if ((!users || users->GetLength() == 0) && (!groups || groups->GetLength() == 0)) { BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " + location + ": No users/user_groups specified.", object->GetDebugInfo())); } -- 2.40.0