Xiyan permission management
This topic describes how to manage permissions in Xiyan GBI to control user access to data tables, columns, and values.
Overview
- Add a permission: Set permissions for data tables or for specific columns and values. These permissions restrict the scope of data that users can query.
- Associate permissions with a role: Create roles and associate permissions with them to control user access to data in Xiyan.
- Verify that permissions take effect: Xiyan GBI validates queries against the user's role permissions, executing only authorized queries and returning results.
- Implement permission isolation: When you use the API for Q&A and data analysis, you can assign different business spaces and roles to users for permission isolation. Note that this feature is not supported in the console.
Prerequisites
You have authorized a database connection in data table management. For details, see database connection.
Procedure
Step 1: Add a permission
Xiyan provides a built-in Full Table Query Permission. This permission is enabled by default and allows users to query all data tables.
If you need to set query permissions for specific data tables, columns, or values, go to the permission management page, click Add Permission, and configure the following parameters:
| Parameter | Description |
|---|---|
| Permission Name | Custom. Use a consistent naming convention to easily identify the permission's purpose. |
| Permission status |
|
| Authorized data scope |
|
| Select Data Table | This parameter appears when you set Authorized data scope to table level. Only tables authorized in data table management are available.
|
| Select columns and values | This parameter appears when you set Authorized data scope to column and value level. Click Add a Group of Columns and Values, select a data table, and then select the columns and values within that table.
Xiyan supports the following value types:
|
Step 2: Associate permissions with a role
Xiyan provides a built-in Super Admin role, which is associated with the Full Table Query Permission by default.
If you need to create a custom role and associate permissions with it, go to the role management page, click Add Role, and configure the following parameters:
| Parameter | Description |
|---|---|
| Role Name | Custom. Use a consistent naming convention to easily identify the role's purpose. |
| Associated permissions | Select the permissions that you want to associate with this role.
|
Step 3: Verify permissions
-
Select the appropriate role when asking a question.
On the Xiyan GBI homepage, select a role above the question input box before submitting your query.
You cannot select the Super administrator role and other roles at the same time.
If a selected role is associated with a permission that uses variable values, you must provide the corresponding variable values before submitting the query. Xiyan verifies whether the provided values are within the allowed scope for the user's role. If the values are not authorized, the request is rejected with the following error message: "Your current role is xxxx, which requires the variable value for [Variable Name]. Please provide the required information and resubmit. This attempt will not count towards your Xiyan usage quota."
Click the Role drop-down list above the question input box to open the role selection dialog. Available roles, such as Super administrator (grants all permissions) and Customer Information Permission, are listed as checkboxes. Select the roles you want and click OK to apply their corresponding permissions to your query.
-
Review the generated SQL.
After a query is submitted and the SQL is generated, Xiyan checks the SQL against your data permissions and displays the final SQL. There are two possible outcomes:
-
If the generated SQL complies with your data permissions, the SQL query is executed, and the results are displayed as charts.
-
If the generated SQL does not comply with your data permissions, the SQL query is not executed. Instead, an error message is displayed: "Sorry, you do not have permission to query this question. table.col1, table.col2 are not within your queryable scope."
ImportantYour Xiyan usage quota is consumed regardless of whether the generated SQL complies with your data permissions.
-
Step 4: Implement permission isolation
Currently, permission isolation is only supported when calling Xiyan GBI through the Chat API.