Notes on User Roles and Permissions

User Roles and Permissions

User Table

  • Consists of main user table, raw stable and hub roles main roles tables.

  • Stores project roles.

  • resource_type field identifies hub roles vs. project roles:

    • null: Hub roles (super admin, admin, hub user).
    • project: Project roles (project user, project admin).
  • resource_id: Project ID or microservice ID.

    • null with resource_type = project: Project main roles.
    • Roles with specific resource_id: Roles specific to each project (e.g., project admin of project ID 13).
  • Gem-related roles and regulations need to be stored for each project with an ID.

    *Example: Project user of project ID 2.

Permissions Table

  • Main table: permissions.
  • Permissions: view, create, edit, remove (CRUD operations).
  • Applied to modules: audiences, projects, microservices, project members, etc.
  • Controller determines project permissions and project role settings.
    • Permissions applied to controller methods (e.g., view audiences for index, create for create method).
  • RK (Remove Key) permission:
    • Initially done with edit (update).
    • Separated into a separate remove method.
    • Allows removing projects or microservices.

Permissions Roles Table

  • Combination of permissions and roles.
  • For permission ID 1 (from the permissions table) and role ID 2 (hub user):
    • status: authenticated or not.

Rankings Table

  • Used to assign an audience to a project or microservice.
  • resource_type determines if it's associated with a microservice or project.
  • rankable_id specifies the microservice ID.