Feat/rbac implementation#686
Open
Tekprecious wants to merge 6 commits into
Open
Conversation
…h OCC Implements an optimistic concurrency control (OCC) mechanism using version numbers to prevent silent data loss during concurrent updates. - Adds a 'version' field to key entities. - Introduces a backend OptimisticLockService for version checking. - Returns 409 Conflict on version mismatch. - Implements a client-side service with automatic retries and exponential backoff. - Prepares for manual conflict resolution via a Zustand store if retries fail. Closes Smartdevs17#613
Clears out multiple workspace errors: - Fixes Prettier layout/syntax issues in crdt.ts and .storybook/main.js. - Resolves import/export name collisions in the design-system barrel file. - Corrects broken relative import paths in test files. - Removes numerous unused variables and imports flagged by the linter.
|
@Tekprecious Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
Quality Gates (All must pass before merge)
Additional Requirements
Reviewers
This PR will not be mergeable until all quality gates pass.
This pull request implements a comprehensive, fine-grained Role-Based Access Control (RBAC) system to enhance security and auditability within SubTrackr. Previously, all team members had identical permissions, posing a significant security risk. This implementation introduces distinct roles, resource-level permissions, and a complete audit trail.
This change introduces the core backend components for RBAC, including:
Database Schema: A new SQL migration (
20260625_rbac_tables.sql) creates four tables:roles: Defines system and custom roles (e.g., Admin, Billing).role_permissions: Maps permissions inresource:actionformat to roles.user_roles: Assigns roles to users, with a safe fallback to 'viewer' on role deletion.permission_audit_logs: A critical table that records every single permission check (bothALLOWandDENY) for full auditability.Permission Logic: The
PermissionRegistry.jsutility provides a robust, static method for checking permissions. It supports exact matches, resource-level wildcards (subscription:*), and a global admin wildcard (all:*).Express Middleware: The
rbacMiddleware.jscontains arequirePermission(permission)factory. This middleware integrates the system by:PermissionRegistryto authorize or deny the request.permission_audit_logstable before responding.This foundational work paves the way for securing all API endpoints and building a user-facing UI for role management.
Closes #607