From 6ad74ef1cccfda8bb462e3ececd2a625085f1740 Mon Sep 17 00:00:00 2001 From: Oliver Rahner Date: Mon, 3 Jun 2019 23:56:21 +0200 Subject: [PATCH] renamed variable $currentUser$ to $user:local_name$ updated docs, too --- doc/06-Security.md | 6 +++--- library/Icinga/User.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/06-Security.md b/doc/06-Security.md index 64bf37685..e0848f405 100644 --- a/doc/06-Security.md +++ b/doc/06-Security.md @@ -216,13 +216,13 @@ results of this query instead: #### Username placeholder -The string `$currentUser` is replaced by the local username (without the domain part) of the logged on user while evaluating restrictions. +The string `$user:local_name$` is replaced by the local username (without the domain part) of the logged on user while evaluating restrictions. This can come in handy if you have some kind of attribute on host or service level defining which user is responsible for a certain host or service. -#### Example : +**Example** ``` -monitoring/filter/objects = (__responsible=$currentUser$|__deputy=$currentUser$) +monitoring/filter/objects = (_responsible=$user:local_name$|_deputy=$user:local_name$) ``` #### Stacking Filters diff --git a/library/Icinga/User.php b/library/Icinga/User.php index 5374d3d9e..0d237831d 100644 --- a/library/Icinga/User.php +++ b/library/Icinga/User.php @@ -253,7 +253,7 @@ class User public function setRestrictions(array $restrictions) { foreach ($restrictions as $name => $restriction) { - $restrictions[$name] = str_replace('$currentUser$', $this->getLocalUsername(), $restriction); + $restrictions[$name] = str_replace('$user:local_name$', $this->getLocalUsername(), $restriction); } $this->restrictions = $restrictions;