When an end-user loads a module, Unqork makes information about that user available through a built-in object called currentUser. Creators use it to personalize content, autopopulate fields, filter data, and build role-based logic without writing custom authentication code.
Available Properties
| Property | Type | Description |
|---|---|---|
currentUser.userId |
String | The ID of the logged-in user. |
currentUser.name |
String | The user's display name. |
currentUser.email |
String | The user's email address. |
currentUser.role |
String | The user's primary Express role. |
currentUser.expressRoles |
array | All Express roles assigned to the user. |
currentUser.groups |
Array | All Express groups the user belongs to. |
currentUser.applicationRoles |
Object | Application-specific roles assigned to the user. |
currentUser.locale |
String | The user's locale (for example, en-US). |
currentUser.isDesignerUser |
Boolean | true if the user is a Creator. Not present for end-users. |
currentUser.isAdmin |
Boolean | true if the user has administrator privileges. |
currentUser.lastLogin |
String | The timestamp of the user's last login, in ISO 8601 format. |
Important:
currentUseris populated during server-side execution and is available in Initializer components, Plug-In components, and server-side workflow nodes. It is not available in client-side component logic.
Where to Use It
Initializer Component
Use currentUser as the source in an Initializer component to autopopulate fields when a module loads.
| Source | Target Property ID | Result |
|---|---|---|
currentUser.name |
requestorName |
Fills the field with the user's display name on load. |
currentUser.email |
requestorEmail |
Fills the field with the user's email address on load. |
currentUser.userId |
submittedBy |
Records who submitted the form. |
Template Expressions
Reference currentUser properties directly in template expressions to display user data in Content components or pass values to Plug-In components.
Welcome, {{ currentUser.name }}.
{{ currentUser.email }}
See Template Expressions for syntax details.
Plug-In Component (Filtering by User)
Pass currentUser.userId as a filter when querying submissions to retrieve only the submissions belonging to the logged-in user.
filter=userId={{ currentUser.userId }}
See Querying Submissions for filter syntax.
Role-Based Logic
Use currentUser.role or currentUser.expressRoles in conditional logic to show or hide content based on the user's role.
currentUser.role: returns a single string with the user's primary role name.currentUser.expressRoles: returns an array, useful when a user has multiple roles and you need to check for any of them.
Anonymous Users
If anonymous access is enabled in the environment and an unauthenticated user loads the module, currentUser properties will be empty or undefined. Design modules that rely on currentUser to require authentication, or handle the unauthenticated case explicitly.
See Environment Administration for anonymous access settings.
Changelog
| Date | Change |
|---|---|
| — | Initial publication. |