]> granicus.if.org Git - icinga2/commitdiff
Change user attribute macros to $USER...$
authorMichael Friedrich <michael.friedrich@netways.de>
Wed, 2 Oct 2013 17:01:03 +0000 (19:01 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Wed, 2 Oct 2013 17:01:03 +0000 (19:01 +0200)
but keep the $CONTACT...$ still supported for compatibility.

fixes #4792

doc/3.3-macros.md
doc/4.3-object-types.md
lib/icinga/user.cpp

index eb90e69411fc1000ff792100b76df4a886a1aea6..2a9ece1b4996f7b89be174af535a5112cc88ad1e 100644 (file)
@@ -135,10 +135,10 @@ users:
 
   Name                   | Description
   -----------------------|--------------
-  CONTACTNAME            | The name of the user object.
-  CONTACTALIAS           | The value of the display_name attribute.
-  CONTACTEMAIL           | This is an alias for the *email* macro.
-  CONTACTPAGER           | This is an alias for the *pager* macro.
+  USERNAME               | The name of the user object.
+  USERDISPLAYNAME        | The value of the display_name attribute.
+  USEREMAIL              | This is an alias for the *email* macro.
+  USERPAGER              | This is an alias for the *pager* macro.
 
 ### Global Macros
 
index f46bf0778caf84ae54d27f6b0565424e57ea80b6..2356f6ce9b29381eb6418a036c844684d58df159 100644 (file)
@@ -313,7 +313,7 @@ Example:
     object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" {
       command = [
         "/opt/bin/send-mail-notification",
-        "$CONTACTEMAIL$",
+        "$USEREMAIL$",
         "$NOTIFICATIONTYPE$ - $HOSTNAME$ - $SERVICEDESC$ - $SERVICESTATE$",
         {{{***** Icinga  *****
 
index 3ab1638161e0e6ba531e0ca149b98f12dbf2ec0e..22f19bfd51ae4a9df875071b09a613f5112c61ad 100644 (file)
@@ -126,18 +126,18 @@ double User::GetLastNotification(void) const
 
 bool User::ResolveMacro(const String& macro, const Dictionary::Ptr&, String *result) const
 {
-       if (macro == "CONTACTNAME") {
+       if (macro == "USERNAME" || macro == "CONTACTNAME") {
                *result = GetName();
                return true;
-       } else if (macro == "CONTACTALIAS") {
+       } else if (macro == "USERDISPLAYNAME" || macro == "CONTACTALIAS") {
                *result = GetDisplayName();
                return true;
        } else {
                String tmacro;
 
-               if (macro == "CONTACTEMAIL")
+               if (macro == "USEREMAIL" || macro == "CONTACTEMAIL")
                        tmacro = "email";
-               else if (macro == "CONTACTPAGER")
+               else if (macro == "USERPAGER" || macro == "CONTACTPAGER")
                        tmacro = "pager";
                else
                        tmacro = macro;