User
The user
table stores authentication information of the users registered in MobyDQ. It is also used to automate database roles management in PostgreSQL. When a user is created in the user
table, the following operations are triggered:
- A new user role
user_<id>
is created in thepg_roles
table. - The
user_<id>
role is automatically granted the default Public user group roleuser_group_1
.
Table: user
Attribute | Type | Description |
---|---|---|
id | Integer | Unique identifier of the user, used as a primary key. |
Text | E-mail of the user, must be unique. | |
role | Text | Role of the user: standard, advanced or admin. |
flag_active | Boolean | Boolean value to indicate if the user is active or inactive. Inactive users cannot login to MobyDQ (WIP). |
created_date | Timestamp | Record created date. |
updated_date | Timestamp | Record last updated date. |
created_by_id | Integer | Foreign key of the user table, to indicate which user created the record. |
updated_by_id | Integer | Foreign key of the user table, to indicate which user updated the record. |
User Group
User groups define a set of users who can access a common set of indicators and data sources. The user group concept is used to manage row level security on the data which means users can only see the records which belong to their groups. When a user group is created in the user_group
table, a new user group role user_group_<id>
is created in the pg_roles
table.
Table: user_group
Attribute | Type | Description |
---|---|---|
id | Integer | Unique identifier of the user, used as a primary key. |
name | Text | Name of the user group, must be unique. |
created_date | Timestamp | Record created date. |
updated_date | Timestamp | Record last updated date. |
created_by_id | Integer | Foreign key of the user table, to indicate which user created the record. |
updated_by_id | Integer | Foreign key of the user table, to indicate which user updated the record. |
User Group Membership
The table user_group_membership
is used to manage the assignment of users to user groups. When a user is associated to a user group in the user_group_membership
table, the user group role user_group_<id>
is automatically granted to the user_<id>
role in the pg_roles
table.
Table: user_group
Attribute | Type | Description |
---|---|---|
id | Integer | Unique identifier of the user, used as a primary key. |
created_date | Timestamp | Record created date. |
created_by_id | Integer | Foreign key of the user table, to indicate which user created the record. |
user_group_id | Integer | Foreign key of the user_group table, to indicate to which user group the user belongs to. |
user_id | Integer | Foreign key of the user table, to indicate to which user is assigned to the user group. |