mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
parent
d56da32a16
commit
7e83247508
@ -30,6 +30,8 @@ using namespace icinga;
|
||||
REGISTER_TYPE(User);
|
||||
REGISTER_SCRIPTFUNCTION(ValidateUserFilters, &User::ValidateFilters);
|
||||
|
||||
boost::signals2::signal<void (const User::Ptr&, bool, const MessageOrigin&)> User::OnEnableNotificationsChanged;
|
||||
|
||||
void User::OnConfigLoaded(void)
|
||||
{
|
||||
SetTypeFilter(FilterArrayToInt(GetTypes(), ~0));
|
||||
@ -49,7 +51,6 @@ void User::OnConfigLoaded(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void User::Stop(void)
|
||||
{
|
||||
DynamicObject::Stop();
|
||||
@ -124,3 +125,19 @@ void User::SetModifiedAttributes(int flags, const MessageOrigin& origin)
|
||||
OnVarsChanged(GetSelf(), origin);
|
||||
}
|
||||
}
|
||||
|
||||
bool User::GetEnableNotifications(void) const
|
||||
{
|
||||
if (!GetOverrideEnableNotifications().IsEmpty())
|
||||
return GetOverrideEnableNotifications();
|
||||
else
|
||||
return GetEnableNotificationsRaw();
|
||||
}
|
||||
|
||||
void User::SetEnableNotifications(bool enabled, const MessageOrigin& origin)
|
||||
{
|
||||
SetOverrideEnableNotifications(enabled);
|
||||
|
||||
OnEnableNotificationsChanged(GetSelf(), enabled, origin);
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,14 @@ public:
|
||||
|
||||
static void ValidateFilters(const String& location, const Dictionary::Ptr& attrs);
|
||||
|
||||
bool GetEnableNotifications(void) const;
|
||||
void SetEnableNotifications(bool enabled, const MessageOrigin& origin = MessageOrigin());
|
||||
|
||||
int GetModifiedAttributes(void) const;
|
||||
void SetModifiedAttributes(int flags, const MessageOrigin& origin = MessageOrigin());
|
||||
|
||||
static boost::signals2::signal<void (const User::Ptr&, bool, const MessageOrigin&)> OnEnableNotificationsChanged;
|
||||
|
||||
protected:
|
||||
virtual void Stop(void);
|
||||
|
||||
|
@ -26,9 +26,11 @@ class User : CustomVarObject
|
||||
[config] String email;
|
||||
[config] String pager;
|
||||
|
||||
[state] bool enable_notifications {
|
||||
[config] bool enable_notifications (EnableNotificationsRaw) {
|
||||
default {{{ return true; }}}
|
||||
};
|
||||
|
||||
[state] Value override_enable_notifications;
|
||||
[state] double last_notification;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user