1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-08-04 23:27:28 +02:00

Implement method 'getRoles' in class 'Auth'

This commit is contained in:
Marco
2018-03-10 02:54:57 +01:00
parent d834623954
commit 012577227a

View File

@@ -1500,6 +1500,19 @@ final class Auth extends UserManager {
return true; 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 * Returns whether the currently signed-in user has been remembered by a long-lived cookie
* *