Roles
Besides the functions listed below, you also have another built-in function available for each existing role. This function, which is automatically defined by the platform, is the following:
Check<role_name>Role
Check Role Functions for more information.
Name | Description |
---|---|
CheckRole(RoleId, UserId) | Returns true when the given user has the specific role. |
GetUserId() | Returns the identifier of the user that is currently authenticated with the server or 'NullIdentifier()' if the user is not authenticated. |
CheckRole
Returns true when the given user has the specific role.
Available in:
- Server-side logic: Yes
- Client-side logic: No
- Database: Can be used with attributes in aggregates.
- Local Storage: Can be used with attributes in aggregates.
Parameters
- RoleId
- Type: RoleId. Mandatory.
The identifier of the role to be validated. - UserId
- Type: UserId. Mandatory.
The identifier of the user for which to validate if role is granted.
Output
Type: Boolean
GetUserId
Returns the identifier of the user that is currently authenticated with the server or 'NullIdentifier()' if the user is not authenticated.
Available in:
- Server-side logic: Yes
- Client-side logic: Yes
- Database: Function is evaluated before the aggregate is executed.
- Local Storage: Function is evaluated before the aggregate is executed.
Output
Type: UserId