RoleEditorModal Documentation
Purpose
The RoleEditorModal is a component used in the Vantage analytics and data platform to create and edit user roles. It allows administrators to assign specific permissions, define budget constraints, and set role-based access for users on the platform. This component helps ensure that users have the appropriate access to features and capabilities based on their organizational role.
Settings
The RoleEditorModal component has several settings, which are categorized into various groups. Below are the detailed explanations of all settings:
1. Role Name
- Name:
name - Input Type: String
- Description: This setting captures the name of the role. Changing it affects how the role is identified within the platform. The name should be descriptive enough to represent the functions of the role clearly.
- Default Value: Empty string (
'')
2. Description
- Name:
description - Input Type: String (textarea)
- Description: This setting allows administrators to provide a brief description of the role's responsibilities and typical tasks. Modifying this field helps communicate the purpose of the role to other administrators.
- Default Value: Empty string (
'')
3. Permissions
- Name:
permissions - Input Type: Object (boolean properties)
- Description: This setting is a collection of key-value pairs representing permissions under different categories like Pages, Settings, Features, AI Features, Integrations, Organization, and Billing. Altering these checkboxes grants or restricts specific functionalities for users assigned to this role.
- Default Value: Empty object (
{})
Permission Options
These options are detailed as follows:
-
View Dashboard
- ID:
view_dashboard - Default: False (not checked)
- ID:
-
Edit Dashboard
- ID:
edit_dashboard - Default: False (not checked)
- ID:
-
View Workflows
- ID:
view_workflows - Default: False (not checked)
- ID:
-
Edit Workflows
- ID:
edit_workflows - Default: False (not checked)
- ID:
-
View Settings
- ID:
view_settings - Default: False (not checked)
- ID:
-
Manage Users
- ID:
manage_users - Default: False (not checked)
- ID:
-
Manage Roles
- ID:
manage_roles - Default: False (not checked)
- ID:
-
Export Data
- ID:
export_data - Default: False (not checked)
- ID:
-
Import Data
- ID:
import_data - Default: False (not checked)
- ID:
-
Enable AI Features
- ID:
aiEnabled - Default: False (not checked)
- ID:
-
Manage Organization AI Snippets
- ID:
manage_ai_org_snippets - Default: False (not checked)
- ID:
-
Manage Integrations
- ID:
manage_integrations - Default: False (not checked)
- ID:
-
Manage Company
- ID:
manage_company - Default: False (not checked)
- ID:
-
Manage Organization
- ID:
manage_organization - Default: False (not checked)
- ID:
-
View Billing
- ID:
view_billing - Default: False (not checked)
- ID:
-
Manage Payment Methods
- ID:
manage_payment_methods - Default: False (not checked)
- ID:
-
Purchase Tokens
- ID:
purchase_tokens - Default: False (not checked)
- ID:
-
Manage Billing Contact
- ID:
manage_billing_contact - Default: False (not checked)
- ID:
4. Credit Budget
- Name:
creditBudget - Input Type: Numeric (number)
- Description: This setting allows the administrator to define a monetary budget for the role. Setting a budget can help control spending on platform resources and features. Setting this to null means no budget is defined.
- Default Value:
null
5. Budget Period
- Name:
budgetPeriod - Input Type: Dropdown (string)
- Description: This setting allows the administrator to specify the time frame for which the credit budget applies. Options include monthly or yearly. Changing it affects how often the budget resets.
- Default Value:
'monthly'
6. Overage Action
- Name:
overageAction - Input Type: Dropdown (string)
- Description: This setting allows the administrator to define the action to be taken when the allocated budget is exceeded. Options include 'warn', 'notify_admin', or 'block', significantly impacting how budget overages are handled.
- Default Value:
'warn'
How It Works
The RoleEditorModal operates as follows:
- Initialization: The modal is initialized with a default role or an existing role's details when opened. If no role is provided, it initializes with empty fields.
- User Input: The user can modify the role name, description, permissions, credit budget, budget period, and overage action.
- Permission Handling: The component contains a handler function to manage changes in permissions—checking or unchecking boxes updates the state accordingly.
- Submission: When the user clicks on the "Save Changes" button, it triggers the
onSavecallback with the complete form data. This includes all changes made in the role's configuration. - Modal Display: The modal remains hidden if
isOpenis false.
Use Cases & Examples
Use Case 1: Creating a New Role for Data Analysts
An organization wishes to enhance its analytical capabilities by creating a new role specifically for data analysts with certain permissions for building dashboards and exporting data.
Use Case 2: Modifying an Existing Manager Role
A company decides to update its existing manager role to restrict access to sensitive integrations while maintaining the ability to manage users and workflows.
Use Case 3: Budget Management for Billing Managers
To improve financial management, the organization needs to assign a budget to its billing manager role, preventing excessive spending while still allowing access to billing functionalities.
Detailed Example Configuration for Use Case 1
To configure the RoleEditorModal for creating a new role intended for Data Analysts, the following settings might be applied:
{
"name": "Data Analyst",
"description": "Role to handle all analytics and dashboard capabilities.",
"context": "organization",
"permissions": {
"view_dashboard": true,
"edit_dashboard": true,
"view_workflows": true,
"edit_workflows": true,
"export_data": true,
"aiEnabled": true
},
"creditBudget": 2000,
"budgetPeriod": "monthly",
"overageAction": "warn"
}In this example, the Data Analyst role is configured to provide significant analytics capabilities while enforcing budget constraints to manage costs effectively.