ScifeonUserHelper
Last updated on 13-May-2020 by Jakob Jakobsen Boysen
On this page
This class is used in conjunction with ScifeonUser
and is automatically instantiated as the static property ScifeonUser.Helper
on that class.
Example
import { User } from 'scifeon';
export class TestClass {
constructor() {
if (User.Helper.hasOneOfRoles(User.ROLE_KEYS.ADMIN)) {
this.adminMessage = 'Is admin';
}
}
}
API
Methods
hasRole(role: string): boolean
hasRole(role: string): boolean
Parameters
role: string
A string from the mapScifeonUser.ROLE_KEYS
Returns
True when the logged on user has the role.
hasOneOfRoles(...roles: string[]): boolean
hasOneOfRoles(...roles: string[]): boolean
Parameters
...roles: string[]
An array of strings from the mapScifeonUser.ROLE_KEYS
Returns
True when the logged on user has one of the roles.
Example
See above.