Skip to content

Rename Django auth permission for Django RQ from "view" to "admin" - #811

Open
terencehonles wants to merge 1 commit into
rq:masterfrom
terencehonles:rename-dashboard-permission
Open

Rename Django auth permission for Django RQ from "view" to "admin"#811
terencehonles wants to merge 1 commit into
rq:masterfrom
terencehonles:rename-dashboard-permission

Conversation

@terencehonles

@terencehonles terencehonles commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This change renames the "view" permission to "admin" as the provided Django RQ admin views allow data modification and an admin may incorrectly grant unintended permissions if the codename is used in a query.

Summary by CodeRabbit

  • Bug Fixes
    • Updated dashboard access permissions so the admin page now uses a single, consistent permission label.
    • Existing access rights were migrated to preserve dashboard availability during the change.

This change renames the "view" permission to "admin" as the provided
Django RQ admin views allow data modification and an admin may
incorrectly grant unintended permissions if the codename is used in a
query.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7568407b-b958-43c0-bbff-6466b599aec5

📥 Commits

Reviewing files that changed from the base of the PR and between 7642312 and 0f1b378.

📒 Files selected for processing (2)
  • django_rq/migrations/0003_alter_dashboard_permission_names.py
  • django_rq/models.py

📝 Walkthrough

Walkthrough

Renames the Dashboard model's declared permission from "view" to "admin" in the model Meta options, and adds a Django migration that updates model options and swaps existing Permission codenames between "view" and "admin" for the Dashboard content type.

Changes

Dashboard Permission Rename

Layer / File(s) Summary
Model permission definition update
django_rq/models.py
Dashboard.Meta.permissions changed from a list-based view permission to a tuple-based admin permission, keeping the same label text.
Migration to rename permission codenames
django_rq/migrations/0003_alter_dashboard_permission_names.py
Adds a permission_migration helper that resolves ContentType, Permission, and Dashboard models and updates matching codenames; defines a Migration class that alters dashboard model options (disables default permissions, sets managed=False, declares only admin permission) and runs the helper twice to swap viewadmin codenames.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: renaming the Django RQ permission codename from view to admin.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@terencehonles
terencehonles marked this pull request as ready for review July 9, 2026 10:16
@terencehonles

Copy link
Copy Markdown
Contributor Author

I tested the migration works appropriately in our app

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.

1 participant