feat: Allow admin/owner to opt out of auto-approval #4308
+88
−30
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.

Allow Admin/Owner to Opt Out of Auto-Approval
Summary
This PR implements an option for admin and owner accounts to disable auto-approval of their own requests, addressing a long-standing feature request. Admin requests can now go through the normal pending → approved flow, enabling integration with third-party tools and manual queue management.
Closes #3926
Problem
Currently, any request made by an admin or owner account is automatically approved and begins processing immediately. This behavior:
Solution
Modified the permission system to treat auto-approve permissions explicitly for admin users, rather than granting them implicitly via the admin role.
Key Changes
server/lib/permissions.tsisAutoApprovePermission()helper functionhasPermission()to NOT bypass auto-approve permission checks for admin userspermissions === 0early return forisAuthenticated()with no argsserver/entity/MediaRequest.tsPermission.MANAGE_REQUESTSfrom auto-approval status checkserver/routes/user/usersettings.tsFrontend Components
PermissionOptionto allow owner to toggle auto-approve in UIPermission Behavior Matrix
MANAGE_*(Users, Requests, Issues)REQUEST*,VIEW*,CREATE*AUTO_APPROVE*AUTO_REQUEST*How to Use
For Admins Who Want Pending Requests
New requests will now go to Pending status instead of being automatically approved.
For Admins Who Want Original Behavior
No action needed. Ensure auto-approve permissions remain checked (they are granted by default for new admin accounts).
Testing Performed
Functional Tests
/auth/mereturns 200)Edge Cases Verified
hasPermission(0, ...)returnstrue(any logged-in user)hasPermission([], ...)returnstrue(empty array)hasPermission([AUTO_APPROVE], ...)requires explicit bit for adminhasPermission([MANAGE_REQUESTS], ...)allows admin bypassComprehensive Permission Audit
All permission behaviors preserved with one intentional change:
Breaking Changes
None. This is backwards-compatible: