mirror of https://github.com/Icinga/icinga2.git
User: register enable_notifications, add GetEnableNotifications()
This commit is contained in:
parent
81b3b57b11
commit
9ad0b11442
|
@ -56,6 +56,7 @@ type Host {
|
|||
%attribute number "check_interval",
|
||||
%attribute number "retry_interval",
|
||||
|
||||
%attribute number "enable_notifications",
|
||||
%attribute number "notification_interval",
|
||||
%attribute name(TimePeriod) "notification_period",
|
||||
|
||||
|
@ -142,6 +143,7 @@ type Host {
|
|||
%attribute number "check_interval",
|
||||
%attribute number "retry_interval",
|
||||
|
||||
%attribute number "enable_notifications",
|
||||
%attribute number "notification_interval",
|
||||
%attribute name(TimePeriod) "notification_period",
|
||||
|
||||
|
@ -279,6 +281,8 @@ type Notification {
|
|||
%attribute number "end",
|
||||
},
|
||||
|
||||
%attribute number "enable_notifications",
|
||||
|
||||
%attribute name(NotificationCommand) "notification_command",
|
||||
|
||||
%attribute number "notification_interval",
|
||||
|
@ -299,6 +303,7 @@ type User {
|
|||
%attribute name(UserGroup) "*"
|
||||
},
|
||||
|
||||
%attribute number "enable_notifications",
|
||||
%attribute number "notification_type_filter",
|
||||
%attribute number "notification_state_filter"
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ User::User(const Dictionary::Ptr& serializedUpdate)
|
|||
RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
|
||||
RegisterAttribute("macros", Attribute_Config, &m_Macros);
|
||||
RegisterAttribute("groups", Attribute_Config, &m_Groups);
|
||||
RegisterAttribute("enable_notifications", Attribute_Config, &m_EnableNotifications);
|
||||
RegisterAttribute("notification_period", Attribute_Config, &m_NotificationPeriod);
|
||||
RegisterAttribute("notification_type_filter", Attribute_Config, &m_NotificationTypeFilter);
|
||||
RegisterAttribute("notification_state_filter", Attribute_Config, &m_NotificationStateFilter);
|
||||
|
@ -76,6 +77,20 @@ Dictionary::Ptr User::GetMacros(void) const
|
|||
return m_Macros;
|
||||
}
|
||||
|
||||
bool User::GetEnableNotifications(void) const
|
||||
{
|
||||
if (m_EnableNotifications.IsEmpty())
|
||||
return true;
|
||||
else
|
||||
return m_EnableNotifications;
|
||||
}
|
||||
|
||||
void User::SetEnableNotifications(bool enabled)
|
||||
{
|
||||
m_EnableNotifications = enabled;
|
||||
Touch("enable_notifications");
|
||||
}
|
||||
|
||||
TimePeriod::Ptr User::GetNotificationPeriod(void) const
|
||||
{
|
||||
return TimePeriod::GetByName(m_NotificationPeriod);
|
||||
|
|
|
@ -46,6 +46,10 @@ public:
|
|||
|
||||
String GetDisplayName(void) const;
|
||||
Array::Ptr GetGroups(void) const;
|
||||
|
||||
/* Notifications */
|
||||
bool GetEnableNotifications(void) const;
|
||||
void SetEnableNotifications(bool enabled);
|
||||
TimePeriod::Ptr GetNotificationPeriod(void) const;
|
||||
unsigned long GetNotificationTypeFilter(void) const;
|
||||
unsigned long GetNotificationStateFilter(void) const;
|
||||
|
@ -60,8 +64,9 @@ protected:
|
|||
private:
|
||||
Attribute<String> m_DisplayName;
|
||||
Attribute<Dictionary::Ptr> m_Macros;
|
||||
Attribute<String> m_NotificationPeriod;
|
||||
Attribute<Array::Ptr> m_Groups;
|
||||
Attribute<bool> m_EnableNotifications;
|
||||
Attribute<String> m_NotificationPeriod;
|
||||
Attribute<long> m_NotificationTypeFilter;
|
||||
Attribute<long> m_NotificationStateFilter;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue