From 1aa42bdaf62acf45e1e215e83c8f80a421b4c889 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 24 Mar 2016 15:30:07 +0100 Subject: [PATCH] lib: Add User::getRoles() and ::setRoles() refs #10887 --- library/Icinga/User.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/library/Icinga/User.php b/library/Icinga/User.php index cbd8c4743..6ec266685 100644 --- a/library/Icinga/User.php +++ b/library/Icinga/User.php @@ -6,6 +6,7 @@ namespace Icinga; use DateTimeZone; use InvalidArgumentException; use Icinga\Application\Config; +use Icinga\Authentication\Role; use Icinga\User\Preferences; use Icinga\Web\Navigation\Navigation; @@ -238,6 +239,29 @@ class User $this->restrictions = $restrictions; } + /** + * Get the roles of the user + * + * @return Role[] + */ + public function getRoles() + { + return $this->roles; + } + + /** + * Set the roles of the user + * + * @param Role[] $roles + * + * @return $this + */ + public function setRoles(array $roles) + { + $this->roles = $roles; + return $this; + } + /** * Getter for username *