userSecurity ^v2.7.0
userSecurity is an interface provided to manage instance security settings related to user accounts and groups.
Functions and Properties
serverSettings()
Retrieves the current instance security settings.
Returns:
- An object containing key-value pairs of security settings.
updateServerSettings(objectSettings)
Enables/disables security on models and their objects within.
Parameters:
objectSettings
- An object where keys are the settings to update and values are booleans indicating wether security is applied to them. Valid keys include "MODELS", "CUBES", "CARDS", "WORKVIEWS", "DIMENSIONS", "PROCESSES", "SCHEDULES", "TABLES", "APPLICATIONS", "MAPPINGS", and "VARIABLES".
Returns:
true
if the settings were successfully updated, otherwisefalse
.
elementSecuritySettings(modelNameOrId)
Retrieves element-level security settings for all dimensions within a specified model.
Parameters:
modelNameOrId
- A string identifier or name of the model.
Returns:
- An object mapping dimension IDs to their respective security settings.
updateElementSecuritySettings(modelNameOrId, dimensionSettings)
Updates security settings for dimensions within a specified model.
Parameters:
modelNameOrId
- A string identifier or name of the model.dimensionSettings
- A object where keys are dimension IDs and values are booleans indicating whether element-level security is applied.
Returns:
true
if the settings were successfully updated, otherwisefalse
.
groups
Provides access to the Groups
interface which manages security groups.
- Usage: Access methods to create, delete, get, list groups, etc.
users
Provides access to the Users
interface which manages user accounts and thier security groups.
- Usage: Access methods to retrieve and manage user details and permissions.
Examples
js
// Retrieve server security settings
var settings = userSecurity.serverSettings();
console.log(settings);
// Update server security settings
var updateSuccess = userSecurity.updateServerSettings({
"MODELS": true,
"CUBES": true,
"CARDS", false
});
console.log(updateSuccess ? "Update successful." : "Update failed.");
// Get a security group by name
var group = userSecurity.groups.get("Admin");
console.log(group.getName());
// Retrieve a user by email
var user = userSecurity.users.getFromEmail("user@example.com");
console.log(user.getName());
// Update model dimension element security settings
var updateDimensionSuccess = userSecurity.updateElementSecuritySettings("Test Model", {
"Dimension A": true,
"Dimension B": false
});
console.log(updateDimensionSuccess ? "update successful." : "update failed.");
// Retrieve server security settings
var settings = userSecurity.serverSettings();
console.log(settings);
// Update server security settings
var updateSuccess = userSecurity.updateServerSettings({
"MODELS": true,
"CUBES": true,
"CARDS", false
});
console.log(updateSuccess ? "Update successful." : "Update failed.");
// Get a security group by name
var group = userSecurity.groups.get("Admin");
console.log(group.getName());
// Retrieve a user by email
var user = userSecurity.users.getFromEmail("user@example.com");
console.log(user.getName());
// Update model dimension element security settings
var updateDimensionSuccess = userSecurity.updateElementSecuritySettings("Test Model", {
"Dimension A": true,
"Dimension B": false
});
console.log(updateDimensionSuccess ? "update successful." : "update failed.");