feat(permissions): add credential access permission system#128
Merged
Josie123-Dev merged 1 commit intoJul 23, 2026
Merged
Conversation
Implement a granular, role-based access control system for credential operations, addressing issue GuardZero144#51. - Define a permission model: granular CredentialPermission levels and named CredentialRole roles with a static role -> permission mapping. - Add a RoleAssignment entity for role grants, scoped globally or to a single credential resource, with optional expiry. Re-granting reactivates rather than duplicating; revocation deactivates to preserve history. - Implement permission checks in PermissionsService (getEffectiveRoles, getEffectivePermissions, hasPermission) honouring scope and expiry. - Add a RequirePermission decorator and PermissionsGuard so other feature modules can protect credential routes declaratively. - Audit every role grant and revocation via the tamper-evident AuditService using new role_assigned / role_revoked operation types. - Expose a REST surface for role management (admin-only), self-inspection and permission checks. - Cover the service and guard with unit tests, and document the system in docs/PERMISSIONS.md.
|
@balisdev is attempting to deploy a commit to the Josie's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Closes #51
Summary
Implements a granular, role-based credential access permission system for the backend (
backend/src/permissions/).permission.model.ts) — granularCredentialPermissionlevels (credential:read/verify/issue/revoke/share,permission:manage,audit:read) and namedCredentialRoles (viewer,verifier,issuer,admin) with a staticROLE_PERMISSIONSmapping as the single source of truth.role-assignment.entity.ts) — assign a role to a wallet, globally (*) or scoped to a single credential resource, with optional expiry. A(grantee, resource, role)triple is unique: re-granting reactivates/refreshes rather than duplicating, and revocation deactivates to preserve history.permissions.service.ts) —getEffectiveRoles,getEffectivePermissionsandhasPermission(wallet, permission, resourceId?), honouring scope (global grants satisfy any resource) and expiry.@RequirePermission(...)decorator +PermissionsGuardso other feature modules can protect their credential routes with a one-liner.AuditService, using two newrole_assigned/role_revokedoperation types.permissions.controller.ts) — admin-only role management, plus self-inspection (GET /permissions/me) and permission checks (POST /permissions/check).Acceptance criteria
PermissionsGuard+@RequirePermissionhasPermissionwith scope/expiry resolutionrole_assigned/role_revokedentriesTesting
permissions.service.spec.ts,permissions.guard.spec.ts(16 tests, all passing).src/permissions/.Documentation added in
backend/docs/PERMISSIONS.md.