From 012577227a3cf0512db2b9e476b75d85c8744ef1 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 10 Mar 2018 02:54:57 +0100 Subject: [PATCH] Implement method 'getRoles' in class 'Auth' --- src/Auth.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Auth.php b/src/Auth.php index 0ff2e59..cdb1d9a 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -1500,6 +1500,19 @@ final class Auth extends UserManager { return true; } + /** + * Returns an array of the user's roles, mapping the numerical values to their descriptive names + * + * @return array + */ + public function getRoles() { + return \array_filter( + Role::getMap(), + [ $this, 'hasRole' ], + \ARRAY_FILTER_USE_KEY + ); + } + /** * Returns whether the currently signed-in user has been remembered by a long-lived cookie *