Change user attribute macros to $USER...$

but keep the $CONTACT...$ still supported for compatibility.

fixes #4792
This commit is contained in:
Michael Friedrich 2013-10-02 19:01:03 +02:00
parent d97d2e399d
commit 972a4f8b9a
3 changed files with 9 additions and 9 deletions

View 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

View 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 *****

View 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;