Users ^v2.7.0
Looks up user accounts.
js
const user = userSecurity.users.getFromEmail("john.doe@example.com");
console.log(user.getName());Constructor
Reached through the userSecurity.users property. It can't be created directly.
Methods
get get(userId) User | null
Returns a User by id, or null when there's no such user.
| Parameter | Type | Description |
|---|---|---|
userId | number | string | The user's numeric id. |
getFromEmail getFromEmail(email) User | null
Returns a User by email address, or null when there's no such user.
| Parameter | Type | Description |
|---|---|---|
email | string | The user's email address. |
getCurrent getCurrent() User
Returns the User running the process.
Examples
js
// Retrieve a user by email
const userByEmail = userSecurity.users.getFromEmail("john.doe@example.com");
console.log("User Retrieved: " + userByEmail.getName());
// Retrieve a user by id
const userById = userSecurity.users.get(123);
console.log("User Retrieved: " + userById.getName());
// Retrieve the user running the process
const currentUser = userSecurity.users.getCurrent();
console.log("Current User: " + currentUser.getName());Related
- User: the user these methods return.