]> granicus.if.org Git - icinga2/commitdiff
Relax the validator for Notification::users/Notification::user_groups a bit
authorGunnar Beutner <gunnar@beutner.name>
Sun, 8 Feb 2015 10:03:10 +0000 (11:03 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Sun, 8 Feb 2015 10:03:10 +0000 (11:03 +0100)
fixes #8067

lib/icinga/notification.cpp

index 4e86dfec88fb9fe7d2f3557cc89877d32ca72a8a..eecf23559cd01f8841622700b01208542fb854f5 100644 (file)
@@ -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<User::Ptr> allUsers;
-
-       std::set<User::Ptr> users = object->GetUsers();
-       std::copy(users.begin(), users.end(), std::inserter(allUsers, allUsers.begin()));
-
-       BOOST_FOREACH(const UserGroup::Ptr& ug, object->GetUserGroups()) {
-               std::set<User::Ptr> 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()));
        }