Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
U
upgrade-data-crawler-fe
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • ThinhNC
  • upgrade-data-crawler-fe
  • Merge Requests
  • !12

Merged
Opened Sep 07, 2026 by ThinhNC@ThinhNC
  • Report abuse
Report abuse

feat(roles,users): implement Roles & Permission Matrix module, dynamic RBAC, and developer tabs

Summary of Changes - Frontend

1. Dynamic Permission-Based Access Control (RBAC)

  • Auth Provider (auth-provider.tsx, auth.ts): Replaced hardcoded role === "ADMIN" checks with dynamic permission evaluators:
    • hasPermission(permission: string): boolean
    • hasAnyPermission(permissions: string[]): boolean
    • hasAllPermissions(permissions: string[]): boolean
    • Exposes active user roles: string[] and permissions: string[].

2. Roles & Visual Permission Matrix (/roles & /settings/developer/roles)

  • Dedicated Role Management Page (src/app/roles/page.tsx):
    • Card & Table dual view modes with impact KPI metrics.
    • Special visual badges for default system roles (ADMIN, USER) with deletion locks.
  • Visual Permission Matrix Dialog (permission-matrix-dialog.tsx):
    • Grouped permissions across 10 business modules (Crawl Jobs, Schedules, Templates, Exports, Webhooks, API Keys, Users, Roles, Audit Logs, Dashboard).
    • Module-level "Select All" / "Deselect All" toggles, realtime search filter, and selection counter.
    • Seamless persistence to PUT /roles/:id/permissions.
  • Role Form Modal (role-form-modal.tsx): Auto-slug generation from Vietnamese display name, system role protection, and description editor.
  • Role Members Modal (role-users-modal.tsx): Displays assigned accounts via GET /roles/:id/users.
  • Role Deletion Guard (role-delete-dialog.tsx): Prevents accidental deletion of system roles or roles with active members.

3. User Management & Developer Area Navigation

  • User Management (src/components/users/): Comprehensive user table with search, role/status filtering, pagination, user creation/edit, and active status toggling.
  • Developer Shell Tabs (developer-shell.tsx): URL-based tab routing (/settings/developer/users, roles, api-keys, webhooks, docs).

4. API Services, Hooks & Schemas

  • Implemented services and TanStack Query hooks for all 10 Roles & Permissions endpoints and 9 User Management endpoints.
  • Full bilingual i18n support (Vietnamese & English) in translations.ts.

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b feat/roles-permission-matrix-and-user-mgmt origin/feat/roles-permission-matrix-and-user-mgmt

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout origin/develop
git merge --no-ff feat/roles-permission-matrix-and-user-mgmt

Step 4. Push the result of the merge to GitLab

git push origin develop

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

  • Discussion 0
  • Commits 1
  • Changes 43
Assignee
No assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
0
Labels
None
Assign labels
  • View project labels
Reference: ThinhNC/upgrade-data-crawler-fe!12

Revert this merge request

This will create a new commit in order to revert the existing changes.

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.