Xiyan permission management

Updated at:

This topic describes how to manage permissions in Xiyan GBI to control user access to data tables, columns, and values.

Overview

  1. 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.
  2. Associate permissions with a role: Create roles and associate permissions with them to control user access to data in Xiyan.
  3. Verify that permissions take effect: Xiyan GBI validates queries against the user's role permissions, executing only authorized queries and returning results.
  4. 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:

ParameterDescription
Permission Name

Custom. Use a consistent naming convention to easily identify the permission's purpose.

Permission status
  • Enabled: The permission is active.
  • Disabled: The permission is inactive.
Authorized data scope
  • Table level: Grants query permissions for the selected data tables. Roles with this permission can query the content of these tables.
  • Column and value level: Grants query permissions for the selected columns and values. Roles with this permission can query data in these specific columns and values.
Select Data Table

This parameter appears when you set Authorized data scope to table level. Only tables authorized in data table management are available.

You can select multiple data tables within a single permission. The relationship between these tables is a logical OR.

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.

You can set up multiple groups of columns and values within a single permission. Each group can only apply to one data table. The available tables are those authorized during data table management.

Xiyan supports the following value types:

  • All values: Allows querying all values in the specified column.
  • Fixed values: Allows querying only the predefined fixed values in the specified column.
  • Variable values: The column value is a dynamic parameter passed at query time. You only need to define a custom variable name. When using this feature through the API, ensure the variable name in the request matches the name defined here.

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:

ParameterDescription
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.

A role can have up to 20 permissions.

Step 3: Verify permissions

  1. 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.

  2. 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.