Skip to content

Element Tag ^v2.7.212 ​

Returns an ElementTag object from the application tags object.

Element Tag Object ​

Methods ​

  • name() ​

    Returns the tag name as a string.

  • type() ​

    Returns "element".

  • users() ​

    Returns an array of User objects assigned to this tag.

  • access() ​

    Returns an object containing the element access entries assigned to this tag.

    Access values are returned as READ, WRITE, or NONE.

  • addUser(userIdOrUserOrEmail) ​

    Assigns a user to this tag and returns true if the user was added, otherwise false.

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

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

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

    Returns true if a user is assigned to this tag, otherwise false.

    • userIdOrUserOrEmail (number | string | object): The user id, email address, or User object.
  • set(element, access) ​

    Sets access for an element on this tag and returns true if the access entry was set, otherwise false.

    • element (string): The element name.
    • access (string): The access level to apply. Valid values are READ, WRITE, or NONE.
  • remove(element) ​

    Removes the access entry for an element and returns true if the entry was removed, otherwise false.

    • element (string): The element name.
  • clear() ​

    Removes all access entries from this tag.

  • json() ​

    Returns the tag as an object.

  • json(includeAccessEntries) ​

    Returns the tag as an object and optionally includes access entries.

    • includeAccessEntries (boolean): If true, includes access entries in the returned object.

Examples ​

js
var applicationSecurity = security.application("My Application");
var tag = applicationSecurity.tags.createElement(
    "Region Access",
    "Account",
    "Default",
);

tag.set("Revenue", "READ_ACCESS");
tag.addUser("user@example.com");

console.log(tag.access());
console.log(tag.json(true));