Skip to content

Application Users ^v2.7.212

Returns the application users object from security.application.

Application Users Object

Methods

  • get(userIdOrEmail)

    Returns a User object assigned to the application, or null if the user is not assigned.

    • userIdOrEmail (string): The user id or email address.
  • list()

    Returns an array of User objects assigned to the application.

  • exists(userIdOrUserOrEmail)

    Returns true if a user is assigned to the application, otherwise false.

    • userIdOrUserOrEmail (number | string | object): The user id, email address, or User object.
  • add(userIdOrUserOrEmail)

    Adds a user to the application and returns true if the user was added, otherwise false.

    • userIdOrUserOrEmail (number | string | object): The user id, email address, or User object.
  • remove(userIdOrUserOrEmail)

    Removes a user from the application and returns true if the user was removed, otherwise false.

    • userIdOrUserOrEmail (number | string | object): The user id, email address, or User object.
  • removeAll()

    Removes all users from the application.

Returned Object

The users object returns the same User object documented under userSecurity.users.

Examples

js
var app = security.application("My Application");
var appUsers = app.users;

var currentUser = userSecurity.users.getCurrent();

console.log(`App contains current user: ${appUsers.exists(currentUser)}`);