feat: implement Approval Process with RunAsNonRoot (#437)#603
Merged
RUKAYAT-CODER merged 1 commit intoMay 30, 2026
Merged
Conversation
- Add CONTENT_APPROVE permission to Permission enum - Add ApprovalItem, ApprovalStatus, SubmitApprovalRequest, ReviewApprovalRequest types to types/api.ts - Create /api/approvals route (GET list, POST submit, PATCH review) with rate limiting, Zod validation, and audit logging - Add ApprovalQueue component (admin-only, gated by CONTENT_APPROVE) with status filtering, approve/reject actions, and review notes - Add SubmitForApproval component (instructor-only, RunAsNonRoot) hidden from admins who use ApprovalQueue instead - Add 22 unit tests covering ACL, API, and both components Closes rinafcode#437
|
@Praizfotos 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.
Summary
Implements the Approval Process with proper RunAsNonRoot semantics — non-privileged users (instructors) can submit content for review without requiring admin/root access. Admins hold the
CONTENT_APPROVEpermission and manage submissions via a dedicated queue.Changes
Permissions & Types (
src/types/api.ts)CONTENT_APPROVEto thePermissionenum (granted toADMINonly viaObject.values)ApprovalItem,ApprovalStatus,SubmitApprovalRequest,ReviewApprovalRequestAPI Route (
src/app/api/approvals/route.ts)GET /api/approvals— list submissions, filterable by statusPOST /api/approvals— submit content for approval (RunAsNonRoot: no elevated privilege required)PATCH /api/approvals— review a submission (approve/reject, admin action)withRateLimit,validateBody/validateQuery(Zod), andlogAuditMutationApprovalQueue Component (
src/components/admin/ApprovalQueue.tsx)CONTENT_APPROVEviaPermissionGatearia-label,aria-pressed,role=alertSubmitForApproval Component (
src/components/approvals/SubmitForApproval.tsx)CONTENT_UPLOAD, notCONTENT_APPROVE)ApprovalQueueinsteadTests (
src/app/api/approvals/__tests__/approvals.test.tsx)Acceptance Criteria
Closes #437