Skip to content

Conversation

@fronc
Copy link

@fronc fronc commented Dec 22, 2025

Description

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.

Why is this change required? Currently, any request made by an admin or owner account is automatically approved and begins processing immediately. This behavior:

  1. Prevents wishlist functionality - Admins cannot maintain a queue of desired media
  2. Breaks third-party tool integration - Tools that intercept pending requests (for availability checking, approval workflows, etc.) cannot process admin requests
  3. Limits admin flexibility - Features are more restricted on accounts with greater permissions

What problem does it solve? This change allows admins to opt out of auto-approval while preserving all existing administrative permissions and functionality. It also fixes a typo in watchlist sync that prevented TV watchlist items from creating requests.

Key Changes:

  • Modified server/lib/permissions.ts to treat auto-approve permissions explicitly for admin users
  • Updated server/entity/MediaRequest.ts to remove Permission.MANAGE_REQUESTS from auto-approval status check
  • Added special handling in server/routes/user/usersettings.ts for owner to modify their own auto-approve permissions
  • Updated frontend components to allow owner to toggle auto-approve in UI
  • Fixed typo in server/lib/watchlistsync.ts (AUTO_APPROVE_TV → AUTO_REQUEST_TV)

Permission Behavior:

Note: This PR description was generated by a heavily scrutinized Claude Code based on very detailed requirements by the code author. Coding assistance was also provided by CC, although this too was closely supervised and always read and understood before each change was implemented. Some code and how to address the problem was also inspired by an Overseerr fork by @ohmzi.

How Has This Been Tested?

Testing Environment:

  • Local development environment
  • Docker container deployment
  • Multiple user roles (admin, owner, regular user)

Functional Tests Performed:

  • ✅ Non-admin users can log in (/auth/me returns 200)
  • ✅ Admin users can log in
  • ✅ Admin with auto-approve disabled → requests go to PENDING
  • ✅ Admin with auto-approve enabled → requests auto-approve
  • ✅ Admin can still approve/reject other users' requests
  • ✅ Admin can still manage users, settings, issues
  • ✅ Owner can toggle auto-approve permissions in UI
  • ✅ Owner cannot modify other permissions on themselves
  • ✅ Notifications still work for admins
  • ✅ Watchlist sync creates requests correctly

Edge Cases Verified:

  • hasPermission(0, ...) returns true (any logged-in user)
  • hasPermission([], ...) returns true (empty array)
  • hasPermission([AUTO_APPROVE], ...) requires explicit bit for admin
  • hasPermission([MANAGE_REQUESTS], ...) allows admin bypass

Comprehensive Permission Audit:
All permission behaviors preserved with one intentional change:

  • Non-admin login: ✅ Works
  • Admin login: ✅ Works
  • Admin creates request: ✅ Goes to PENDING (if auto-approve disabled)
  • Admin approves others' requests: ✅ Works
  • Admin manages users: ✅ Works
  • Admin changes settings: ✅ Works
  • Owner edits auto-approve: ✅ Can toggle
  • Owner edits other permissions: ✅ Blocked
  • Non-owner edits owner: ✅ Blocked
  • Watchlist sync: ✅ Creates requests

Screenshots / Logs (if applicable)

Recording 2025-12-22 124828

Checklist:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract - Not required, no new UI text added
  • Database migration (if required) - Not required, no database schema changes

@fronc fronc requested a review from a team as a code owner December 22, 2025 04:18
This commit enables admin users to opt out of auto-approval, for cases
like allowing third-party tools (Availarr, Ombi, etc.) to intercept
and process media requests before they are automatically approved.

Changes:
- Modified hasPermission() to not auto-grant auto-approve permissions
  for admins - they must be explicitly enabled
- Removed MANAGE_REQUESTS from auto-approval checks in MediaRequest.ts
- Fixed watchlist sync typo: AUTO_APPROVE_TV -> AUTO_REQUEST_TV
- Added ability for owner (user ID 1) to modify their own auto-approve
  permissions via the UI
- Updated frontend UI to correctly reflect auto-approve status

Files changed:
- server/lib/permissions.ts: New isAutoApprovePermission() helper
- server/entity/MediaRequest.ts: Remove MANAGE_REQUESTS from checks
- server/lib/watchlistsync.ts: Fix permission typo
- server/routes/user/usersettings.ts: Allow owner auto-approve changes
- src/components/PermissionOption/index.tsx: UI editability for owner
- src/components/RequestModal/*.tsx: Consistent hasAutoApprove checks
When hasPermission is called with 0 (no permission required),
return true immediately. This was accidentally removed during
the admin auto-approve fix, breaking /auth/me for non-admin users.
@fallenbagel
Copy link
Collaborator

Please update the pr description with the proper pr template.

@fronc
Copy link
Author

fronc commented Dec 22, 2025

Please update the pr description with the proper pr template.

Thank you, and apologies - I really did search for this before submitting. But after looking again and reviewing the Contributions docs, I still cannot find a template anywhere. Could you please direct me to the appropriate resources?

@M0NsTeRRR
Copy link
Member

The template is here : https://github.com/seerr-team/seerr/blob/develop/.github%2FPULL_REQUEST_TEMPLATE.md

@fronc
Copy link
Author

fronc commented Dec 22, 2025

Thank you! I've updated accordingly and added screenshots. Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Option to disable auto approve for admin and owner accounts

4 participants