Load Notification objects after User and UserGroup

Notification objects can refer User and Group objects similar to how they can
refer Host and Service objects, so that dependency feels quite natural. Note
that for evaluating most configuration, this order doesn't really matter, the
configuration will successfully evaluate in either case, the difference can be
noticed mainly in more advanced configurations, for example when dynamically
assigning user based on their groups. When accessing user objects from the
Notification object definition (like in the following example), without this
change, only groups configured directly in groups attribute of User objects are
visible and those added via assign clauses in UserGroup objects are missing.
With this commit, these are also visible.

    apply Notification "n" to Host {
        for (var u in get_objects(User)) {
            log(u.name + " -> " + Json.encode(u.groups))
        }

        # [...]
    }
This commit is contained in:
Julian Brost 2025-04-29 11:10:36 +02:00
parent a65f2d6b41
commit cc48c924ae

View File

@ -22,6 +22,8 @@ class Notification : CustomVarObject < NotificationNameComposer
{
load_after Host;
load_after Service;
load_after User;
load_after UserGroup;
[config, protected, required, navigation] name(NotificationCommand) command (CommandRaw) {
navigate {{{