Skip to content

Group ^v2.7.0

Represents a security group within the system, providing methods to manage its properties and permissions.

Functions and Properties


  • getId()

    Retrieves the unique identifier of the group.

    • Returns:

      • The group's ID as a string.

  • getName()

    Retrieves the name of the group.

    • Returns:

      • The group's name.

  • isDeletable()

    Checks if the group can be deleted.

    • Returns:

      • true if the group is deletable, otherwise false.

  • isEditable()

    Checks if the group's details and permissions can be edited.

    • Returns:

      • true if the group is editable, otherwise false.

  • delete()

    Deletes the group.

    • Returns:

      • true if the group was successfully deleted, otherwise false.

  • rename(newName)

    Renames the group.

    • Parameters:

      • newName - The new name for the group.
    • Returns:

      • true if the group was successfully renamed, otherwise false.

  • setModelPermissions(modelNameOrId, accessLevel)

    Sets access level for a specific model for this group.

    • Parameters:

    • modelNameOrId - The identifier or name of the model.
    • accessLevel - The access level to set (e.g., READ_ACCESS, WRITE_ACCESS, NO_ACCESS).

  • getModelPermissions(modelNameOrId)

    Retrieves the current access level set for a specific model.

    • Parameters:

    • modelNameOrId - The identifier or name of the model.

  • setObjectPermissions(modelNameOrId, objectType, objectKey, accessLevel)

    Sets access level for a specific object within a model for this group.

    • Parameters:

      • modelNameOrId - Identifier or name of the model.
      • objectType - Type of the object within the model, such as CUBES, CARDS, WORKVIEWS, DIMENSIONS, PROCESSES, SCHEDULES, TABLES, APPLICATIONS, MAPPINGS, or VARIABLES.
      • objectKey - Key or identifier of the specific object.
      • accessLevel - Desired access level (e.g., READ_ACCESS, WRITE_ACCESS, NO_ACCESS).
    • Returns:

      • true if the permissions were successfully set, otherwise false.

  • getObjectPermissions(modelNameOrId, objectType)

    Retrieves the access level for a specific object type within a model.

    • Parameters:

      • modelNameOrId - Identifier or name of the model.
      • objectType - Type of the object within the model, such as CUBES, CARDS, WORKVIEWS, DIMENSIONS, PROCESSES, SCHEDULES, TABLES, APPLICATIONS, MAPPINGS, or VARIABLES.
    • Returns:

      • An object containing the current access level for the specified object type.

  • getElementPermissions(modelNameOrId, dimensionNameOrId, HierarchyNameOrId)

    Retrieves access levels for elements within a specific hierarchy and dimension of a model.

    • Parameters:

      • modelNameOrId - Identifier or name of the model.
      • dimensionNameOrId - Identifier or name of the dimension within the model.
      • HierarchyNameOrId - Identifier or name of the hierarchy within the dimension.
    • Returns:

      • An array of objects, each representing an element's access level within the hierarchy.

  • setElementPermissions(modelNameOrId, dimensionNameOrId, HierarchyNameOrId, permissions)

    Sets access levels for specific elements within a hierarchy and dimension of a model.

    • Parameters:

      • modelNameOrId - Identifier or name of the model.
      • dimensionNameOrId - Identifier or name of the dimension.
      • HierarchyNameOrId - Identifier or name of the hierarchy.
      • permissions - Object where keys are element identifiers (without hierarchy) and values are desired access levels.
    • Returns:

      • true if the permissions were successfully set, otherwise false.

  • setAllModelPermissions(modelNameOrId, accessLevel)

    Sets a uniform access level for all objects and elements within a specific model.

    • Parameters:

      • modelNameOrId - Identifier or name of the model.
      • accessLevel - Desired access level for all items within the model.
    • Returns:

      • true if the permissions were successfully set across the model, otherwise false.

  • setAllHierarchyPermissions(modelNameOrId, dimensionNameOrId, hierarchyNameOrId, accessLevel)

    Sets a uniform access level for all elements within a specified hierarchy or all hierarchies of a dimension in a model.

    • Parameters:

      • modelNameOrId - Identifier or name of the model.
      • dimensionNameOrId - Identifier or name of the dimension.
      • hierarchyNameOrId - Identifier or name of the hierarchy, if this is null or empty it will apply permissions to all hierarchies in the dimension.
      • accessLevel - Desired access level for all elements within the hierarchy.
    • Returns:

      • true if the permissions were successfully set, otherwise false.

Examples

js
// Retrieve group ID and name
var group = userSecurity.groups.get("Example Group");
console.log("Group ID: " + group.getId());
console.log("Group Name: " + group.getName());

// Check if the group is editable and delete if possible
if (group.isDeletable()) {
    var deleted = group.delete();
    console.log(deleted ? "Group deleted successfully." : "Failed to delete group.");
}

// Rename a group
var renameSuccess = group.rename("Example Group");
console.log(renameSuccess ? "Group renamed successfully." : "Failed to rename group.");

// Example: Setting model access level for a group
var group = userSecurity.groups.get("Example Group");
var setModelPermSuccess = group.setModelPermissions("Test Model", "READ_ACCESS");
console.log(setModelPermSuccess ? "Model permissions set successfully." : "Failed to set model permissions.");

// Example: Getting model access level for a group
var modelPermissions = group.getModelPermissions("Test Model");
console.log("Model Permissions: ", modelPermissions);

// Example: Setting object permissions within a model for a group
var setObjectPermSuccess = group.setObjectPermissions("Test Model", "CUBES", "Test Cube", "WRITE_ACCESS");
console.log(setObjectPermSuccess ? "Object permissions set successfully." : "Failed to set object permissions.");

// Example: Retrieving object permissions for a group
var objectPermissions = group.getObjectPermissions("Test Model", "CUBES");
console.log("Object Permissions: ", objectPermissions);

// Example: Setting element permissions within a hierarchy for a group
var permissionsMap = {
    "North America": "WRITE_ACCESS",
    "Europe": "NO_ACCESS"
};
var setElementPermSuccess = group.setElementPermissions("Sales Model", "Geography", "Regions Hierarchy", permissionsMap);
console.log(setElementPermSuccess ? "Element permissions set successfully." : "Failed to set element permissions.");

// Example: Getting element permissions within a hierarchy for a group
var elementPermissions = group.getElementPermissions("Sales Model", "Geography", "Regions Hierarchy");
console.log("Element Permissions: ", elementPermissions);

// Example: Setting uniform permissions for an entire model and its containing objects within a group
var setAllModelPermSuccess = group.setAllModelPermissions("Test Model", "READ_ACCESS");
console.log(setAllModelPermSuccess ? "All model permissions set successfully." : "Failed to set all model permissions.");

// Example: Setting uniform permissions for all elements within a hierarchy
var setAllHierarchyPermSuccess = group.setAllHierarchyPermissions("Sales Model", "Geography", "Regions Hierarchy", "READ_ACCESS");
console.log(setAllHierarchyPermSuccess ? "All hierarchy permissions set successfully." : "Failed to set all hierarchy permissions.");

// Example: Setting uniform permissions for all elements within all hierarchies in a dimension
var setAllElementPermSuccess = group.setAllHierarchyPermissions("Sales Model", "Geography", null, "READ_ACCESS");
console.log(setAllElementPermSuccess ? "All dimension element permissions set successfully." : "Failed to set all dimension element permissions.");
// Retrieve group ID and name
var group = userSecurity.groups.get("Example Group");
console.log("Group ID: " + group.getId());
console.log("Group Name: " + group.getName());

// Check if the group is editable and delete if possible
if (group.isDeletable()) {
    var deleted = group.delete();
    console.log(deleted ? "Group deleted successfully." : "Failed to delete group.");
}

// Rename a group
var renameSuccess = group.rename("Example Group");
console.log(renameSuccess ? "Group renamed successfully." : "Failed to rename group.");

// Example: Setting model access level for a group
var group = userSecurity.groups.get("Example Group");
var setModelPermSuccess = group.setModelPermissions("Test Model", "READ_ACCESS");
console.log(setModelPermSuccess ? "Model permissions set successfully." : "Failed to set model permissions.");

// Example: Getting model access level for a group
var modelPermissions = group.getModelPermissions("Test Model");
console.log("Model Permissions: ", modelPermissions);

// Example: Setting object permissions within a model for a group
var setObjectPermSuccess = group.setObjectPermissions("Test Model", "CUBES", "Test Cube", "WRITE_ACCESS");
console.log(setObjectPermSuccess ? "Object permissions set successfully." : "Failed to set object permissions.");

// Example: Retrieving object permissions for a group
var objectPermissions = group.getObjectPermissions("Test Model", "CUBES");
console.log("Object Permissions: ", objectPermissions);

// Example: Setting element permissions within a hierarchy for a group
var permissionsMap = {
    "North America": "WRITE_ACCESS",
    "Europe": "NO_ACCESS"
};
var setElementPermSuccess = group.setElementPermissions("Sales Model", "Geography", "Regions Hierarchy", permissionsMap);
console.log(setElementPermSuccess ? "Element permissions set successfully." : "Failed to set element permissions.");

// Example: Getting element permissions within a hierarchy for a group
var elementPermissions = group.getElementPermissions("Sales Model", "Geography", "Regions Hierarchy");
console.log("Element Permissions: ", elementPermissions);

// Example: Setting uniform permissions for an entire model and its containing objects within a group
var setAllModelPermSuccess = group.setAllModelPermissions("Test Model", "READ_ACCESS");
console.log(setAllModelPermSuccess ? "All model permissions set successfully." : "Failed to set all model permissions.");

// Example: Setting uniform permissions for all elements within a hierarchy
var setAllHierarchyPermSuccess = group.setAllHierarchyPermissions("Sales Model", "Geography", "Regions Hierarchy", "READ_ACCESS");
console.log(setAllHierarchyPermSuccess ? "All hierarchy permissions set successfully." : "Failed to set all hierarchy permissions.");

// Example: Setting uniform permissions for all elements within all hierarchies in a dimension
var setAllElementPermSuccess = group.setAllHierarchyPermissions("Sales Model", "Geography", null, "READ_ACCESS");
console.log(setAllElementPermSuccess ? "All dimension element permissions set successfully." : "Failed to set all dimension element permissions.");