Skip to content

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.

ParameterTypeDescription
usernumber | stringThe user's id or email address.

exists exists(user) boolean ​

Returns true when a user is assigned to the application.

ParameterTypeDescription
usernumber | string | UserThe 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.

ParameterTypeDescription
usernumber | string | UserThe 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.

ParameterTypeDescription
usernumber | string | UserThe 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());
}