Updated on 2024-11-29 GMT+08:00

Viewing a User's or Role's Permissions

View system permissions and object permissions of a user.

Procedure

  1. Log in to FusionInsight Manager, choose Cluster > Services > MOTService, click Instance, and view and record the service IP address of the MOTServer(Active) instance.
  2. Log in to the active MOTService node as user omm and run the following command to start environment variables:

    source ${MOTSERVER_HOME}/.motservice_profile

  3. Run the following command to connect to the MOTService database and enter the password of user omm:

    gsql -d postgres -p 20105

    Contact the system administrator to obtain the password of user omm for the MOTService database.

  4. View system permissions of the user.

    For example, to view the system permissions of the user joe, run the following command:

    \du joe

    The command output is as follows:

               List of roles
     Role name | Attributes | Member of
    -----------+------------+-----------
     joe       | Create DB  | {}

    Create DB indicates that user joe has the permission to create a database.

  5. View object permissions of the user.

    Run the following command to switch to user joe:

    SET ROLE joe password "password";

    If the following information is displayed, the switching is successful:

    SET

    Run the following command to create the database music1:

    CREATE DATABASE music1;

    Query existing databases.

    postgres=> \l
                                    List of databases
          Name      |  Owner   | Encoding  | Collate | Ctype |   Access privileges   
    ----------------+----------+-----------+---------+-------+-----------------------
     music1         | joe      | SQL_ASCII | C       | C     | 
     postgres       | omm | SQL_ASCII | C       | C     | 
     template0      | omm | SQL_ASCII | C       | C     | =c/omm          +
                    |          |           |         |       | omm=CTc/omm
     template1      | omm | SQL_ASCII | C       | C     | =c/omm          +
                    |          |           |         |       | omm=CTc/omm
    (5 rows)