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, orNONE.addUser(userIdOrUserOrEmail)Assigns a user to this tag and returns
trueif the user was added, otherwisefalse.userIdOrUserOrEmail(number | string | object): The user id, email address, or User object.
removeUser(userIdOrUserOrEmail)Removes a user from this tag and returns
trueif the user was removed, otherwisefalse.userIdOrUserOrEmail(number | string | object): The user id, email address, or User object.
hasUser(userIdOrUserOrEmail)Returns
trueif a user is assigned to this tag, otherwisefalse.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
trueif the access entry was set, otherwisefalse.element(string): The element name.access(string): The access level to apply. Valid values areREAD,WRITE, orNONE.
remove(element)Removes the access entry for an element and returns
trueif the entry was removed, otherwisefalse.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): Iftrue, 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));