ScreenTag ^v2.7.212
An access tag that controls which screens its users can see.
js
const app = security.application("My Application");
const tag = app.tags.createScreen("Planner Screens");
tag.set("Planner", true);
tag.addUser("user@example.com");Constructor
Returned by createScreen() and get() on an application's tags. It can't be created directly.
Overview
- Hidden by default: a new screen tag hides every screen until you show them with set().
- Users: methods that take a user accept their id, email address or a User.
Methods
id id() string
Returns the tag's id.
name name() string
Returns the tag's name.
type type() string
Returns "screen".
access access() object
Returns the tag's screen entries. Each key is a screen title and each value is true when the screen is visible.
set set(screenIdOrTitle, visible) boolean
Shows or hides a screen for the tag's users. Returns false when the screen can't be found.
| Parameter | Type | Description |
|---|---|---|
screenIdOrTitle | string | The screen's id or title. |
visible | boolean | true to show the screen, false to hide it. |
clear clear() boolean
Removes every screen entry from the tag.
users users() User[]
Returns the User objects that hold this tag.
hasUser hasUser(user) boolean
Returns true when a user holds this tag.
| Parameter | Type | Description |
|---|---|---|
user | number | string | User | The user's id or email address, or the user. |
addUser addUser(user) boolean
Gives a user this tag. Returns true when it was added.
| Parameter | Type | Description |
|---|---|---|
user | number | string | User | The user's id or email address, or the user. |
removeUser removeUser(user) boolean
Takes this tag from a user. Returns true when it was removed.
| Parameter | Type | Description |
|---|---|---|
user | number | string | User | The user's id or email address, or the user. |
json json(includeAccessEntries) object
Returns the tag as an object, with its id, name and type.
| Parameter | Type | Description |
|---|---|---|
includeAccessEntries | boolean | Optional. true to include the screen entries under access. |
Examples
js
const app = security.application("My Application");
const tag = app.tags.createScreen("Planner Screens");
tag.set("Planner", true);
tag.set("Admin", false);
tag.addUser("user@example.com");
console.log(tag.access());
console.log(tag.json(true));Related
- ApplicationTags: creates and finds tags.
- ElementTag: the other kind of tag.