mirror of
https://github.com/Icinga/icinga2.git
synced 2025-05-16 04:20:15 +02:00
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)
|
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();
|
if ((!users || users->GetLength() == 0) && (!groups || groups->GetLength() == 0)) {
|
||||||
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()) {
|
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||||
location + ": No users/user_groups specified.", object->GetDebugInfo()));
|
location + ": No users/user_groups specified.", object->GetDebugInfo()));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user