ApplicationUsers ^v2.7.212
The users assigned to an application.
js
const app = security.application("My Application");
app.users.add("user@example.com");Constructor
Reached through the users property of an ApplicationSecurity. It can't be created directly.
Overview
- Users: methods that take a user accept their id, email address or a User.
Methods
list list() User[]
Returns every User assigned to the application.
get get(user) User | null
Returns a User assigned to the application, or null when they aren't assigned.
| Parameter | Type | Description |
|---|---|---|
user | number | string | The user's id or email address. |
exists exists(user) boolean
Returns true when a user is assigned to the application.
| Parameter | Type | Description |
|---|---|---|
user | number | string | User | The user's id or email address, or the user. |
add add(user) boolean
Assigns a user to the application. Returns true when they were added, or false when they're already assigned or can't be found.
| Parameter | Type | Description |
|---|---|---|
user | number | string | User | The user's id or email address, or the user. |
remove remove(user) boolean
Unassigns a user from the application. Returns true when they were removed.
| Parameter | Type | Description |
|---|---|---|
user | number | string | User | The user's id or email address, or the user. |
removeAll removeAll() boolean
Unassigns every user from the application.
Examples
js
const app = security.application("My Application");
const currentUser = userSecurity.users.getCurrent();
if (!app.users.exists(currentUser)) {
app.users.add(currentUser);
}
for (const user of app.users.list()) {
console.log(user.getEmail());
}Related
- User: the user objects these methods return.
- ApplicationTags: gives users access tags.