反馈已提交

网络繁忙

Assigning Permissions Through System Parameters

  • Last update:  2023-05-17
  • Overview

    Version

    FineBI Version

    Functional Change

    6.0

    /

    Application Scenarios

    Many companies hope that their employees can only see data related to themselves in certain data tables.

    In addition to multi-level permissions, this scenario can also be achieved by adding FineBI system parameters.

    Functions

    You can automatically obtain the username of the current user, department, position, role through system parameters.

    System Parameter

    Definition

    Example of Return Value

    $fine_username

    Username parameter of login user

    $fine_username = eoco

    $fine_role

    Role parameter of login user

    $fine_role = [{test leader, test member}]

    Note: When the role is empty, the parameter returns an empty string.

    $fine_position

    Parameter for the collection of organizations to which the login user belongs

    The returned value is an array in JSON format.

    $fine_positon = [{jobTitle=minister, departments=human resources}, {jobTitle=development leader, departments=FineBI development team}]

    Note: 

    1. When the department and position is empty, the parameter returns an empty string.

    2. If a user has multiple roles, departments, and positions, the SPLIT function can be used in conjunction with the SQL dataset to extract the first position field.

    Example: select * from aaa_user where position='${indexOfArray(SPLIT(indexOfArray(SPLIT(fine_position,'='),2),','),1)}'

    $fine_display_name

    Get the login username

    For example, the login username is Anna.

    $fine_display_name = Anna

    Notes

    In dashboard analysis, system parameters cannot be bound and filtered in Filter Component. Special parameters are hidden by default.

    The method introduced in this article requires to be performed with real-time data. Only by this, tables in direct databases can be used normally.

    Example

    Taking the user information table aaa_user under the built-in data FRDemo as an example. Use the system parameter fine_username.

    Creating a Server Dataset

    The admin logs into the FineBI system, clicks Manage > Data Connection > Server Dataset, and creates a SQL Dataset.

    1.png

    Set the name of the dataset as User Information Table, select data source as FRDemo, add SQL statement select * from aaa_user, and click Save.

     2.png

    Importing Users

    The admin logs into FineBI, goes to Manage > User > All Users, and clicks Import User.

    Select the server dataset User Information Table and set the corresponding information such as UsernamePasswordDept., and Position, and click OK.

     3.png

    Setting User Type

    In the Platform User interface, if there is No limit on user number of PC User and its subcategories, then there is no need to follow the procedures in this section.

    In the Platform User interface, if the number of users in PC User and its subcategories is limited, you have to follow the procedures in this section, otherwise you cannot view the dashboard.

    The admin logs into FineBI, clicks Manage > User > Platform User, and adds the imported users to BI User (BI View User or BI design user).

     4.png

    Creating a SQL Dataset

    The admin logs into FineBI, goes to Public Data, clicks 0, and switches New dataset property settings to Direct data.

    5.png

    The admin logs into FineBI, goes to Public Data, clicks New Folder, and renames the folder Direct Data.

     6.png

    Select the folder and add SQL Dataset.

    Set the name of the dataset as User Information Table, enter the SQL statement select * from aaa_user where account='${fine_username}', obtain the parameter of fine_username, and click OK.

    Note:

    1. Only real-time data is supported. Spider is not supported.

    2. Parameters cannot be written in the selected fields section of SQL. For example: select {account} as '${fine_username}', {password}, {organization}, {position} from aaa_user. Parameters can only be written in the filter condition. FineBI does not allow dynamically selecting fields.

    3. If the admin views this table and finds no data, this is because that there is actually no information about the admin in this table.

     7.png

    Assigning Using Permission of Data

    The admin logs into FineBI, goes to Manage > Permission > General permission configuration, and selects the permission carrier All Departments.

    Click Data Authorization to configure Use permission for the folder Direct Data.

     8.png

    Demonstration

    Note: Admin cannot see any data in this table, because the filtering condition of the SQL statement is where account = '${fine_username}'. There is actually no information of the admin in the table.

    Jenny logs into FineBI, clicks Public Data > Direct Data User Information Table, and can only view their own information.

    9.png

    附件列表


    主题: System Management
    Previous
    Next
    • Helpful
    • Not helpful
    • Only read

    feedback

    鼠标选中内容,快速反馈问题

    鼠标选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。

    不再提示

    10s后关闭