userSecurity ^v2.7.0
Manages instance security settings, user accounts and security groups.
js
const group = userSecurity.groups.get("Finance");
const user = userSecurity.users.getFromEmail("user@example.com");
user.addGroup(group);Properties
| Property | Type | Description |
|---|---|---|
users | Users | Looks up user accounts. |
groups | Groups | Creates, finds and deletes security groups. |
Methods
serverSettings serverSettings() object
Returns which object types are secured on this instance. Each key is an object type, such as "MODELS" or "CUBES", and each value is true when that type is secured.
updateServerSettings updateServerSettings(objectSettings) boolean
Turns security on or off for object types on this instance. Returns true when the settings were saved.
| Parameter | Type | Description |
|---|---|---|
objectSettings | object | Each key is an object type and each value is true to secure it or false to unsecure it. Object types are "MODELS", "CUBES", "CARDS", "WORKVIEWS", "DIMENSIONS", "PROCESSES", "CODELESS", "SCHEDULES", "TABLES", "APPLICATIONS", "MAPPINGS" and "VARIABLES". |
elementSecuritySettings elementSecuritySettings(modelNameOrId) object
Returns which dimensions in a model have element security turned on. Each key is a dimension id, and each value has the dimension's name and element_security (true when it's on).
| Parameter | Type | Description |
|---|---|---|
modelNameOrId | string | The model's name or id. |
updateElementSecuritySettings updateElementSecuritySettings(modelNameOrId, dimensionSettings) boolean
Turns element security on or off for dimensions in a model. Returns true when the settings were saved. If any dimension isn't found, nothing is changed.
| Parameter | Type | Description |
|---|---|---|
modelNameOrId | string | The model's name or id. |
dimensionSettings | object | Each key is a dimension id and each value is true to turn element security on or false to turn it off. |
Examples
Secure cubes and cards
js
const settings = userSecurity.serverSettings();
console.log(settings);
const updated = userSecurity.updateServerSettings({
"MODELS": true,
"CUBES": true,
"CARDS": false
});
console.log(updated ? "Update successful." : "Update failed.");Turn on element security for some dimensions
js
const updated = userSecurity.updateElementSecuritySettings("Test Model", {
"Dimension A": true,
"Dimension B": false
});
console.log(updated ? "Update successful." : "Update failed.");