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 the pg_roles table.
  • The user_<id> role is automatically granted the default Public user group role user_group_1.

Table: user

AttributeTypeDescription
idIntegerUnique identifier of the user, used as a primary key.
emailTextE-mail of the user, must be unique.
roleTextRole of the user: standard, advanced or admin.
flag_activeBooleanBoolean value to indicate if the user is active or inactive. Inactive users cannot login to MobyDQ (WIP).
created_dateTimestampRecord created date.
updated_dateTimestampRecord last updated date.
created_by_idIntegerForeign key of the user table, to indicate which user created the record.
updated_by_idIntegerForeign 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

AttributeTypeDescription
idIntegerUnique identifier of the user, used as a primary key.
nameTextName of the user group, must be unique.
created_dateTimestampRecord created date.
updated_dateTimestampRecord last updated date.
created_by_idIntegerForeign key of the user table, to indicate which user created the record.
updated_by_idIntegerForeign 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

AttributeTypeDescription
idIntegerUnique identifier of the user, used as a primary key.
created_dateTimestampRecord created date.
created_by_idIntegerForeign key of the user table, to indicate which user created the record.
user_group_idIntegerForeign key of the user_group table, to indicate to which user group the user belongs to.
user_idIntegerForeign key of the user table, to indicate to which user is assigned to the user group.