summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2017-03-26 04:14:58 -0400
committerMalf Furious <m@lfurio.us>2017-03-26 04:14:58 -0400
commit173b002d3f9de83f93fc1a0128febcc44410c3d0 (patch)
treef4effc8f9f44a9f3236394554201dcdf6bd0d208
parentf4c10ec42537241fb77c93fa0eb1e31824c3aa73 (diff)
downloadscrott-173b002d3f9de83f93fc1a0128febcc44410c3d0.tar.gz
scrott-173b002d3f9de83f93fc1a0128febcc44410c3d0.zip
Add function agent::getDisplayName()
Diffstat (limited to '')
-rw-r--r--app/class/agent.class.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/class/agent.class.php b/app/class/agent.class.php
index 52bfc1e..038c485 100644
--- a/app/class/agent.class.php
+++ b/app/class/agent.class.php
@@ -51,6 +51,24 @@ abstract class agent extends object
}
/*
+ * Get the display name for this agent. For groups this is the
+ * object name; for users, this is the object name, unless an
+ * alias is set.
+ */
+ public function getDisplayName() : string
+ {
+ if ($this->objtype != "user")
+ return $this->name;
+
+ $user = new user($this->guid);
+
+ if ($user->alias != "")
+ return $user->alias;
+
+ return $user->name;
+ }
+
+ /*
* Check whether this agent has access permission for given
* object
*/