mirror of https://github.com/Icinga/icinga2.git
Relax the validator for Notification::users/Notification::user_groups a bit
fixes #8067
This commit is contained in:
parent
b23d58dccc
commit
e456cfd99c
|
@ -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;
|
||||
Array::Ptr users = object->GetUsersRaw();
|
||||
Array::Ptr groups = object->GetUserGroupsRaw();
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
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()));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue