Skip to content

AO3-7468 Preload current_user roles - #6002

Open
y7nieSEl5 wants to merge 2 commits into
otwcode:masterfrom
y7nieSEl5:AO3-7468
Open

AO3-7468 Preload current_user roles#6002
y7nieSEl5 wants to merge 2 commits into
otwcode:masterfrom
y7nieSEl5:AO3-7468

Conversation

@y7nieSEl5

Copy link
Copy Markdown
Contributor

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-7468

Purpose

This PR preloads a user's roles when Devise restores current_user from the session. As a result, subsequent has_role? permission checks use the loaded association instead of performing repeated role lookups throughout the request.

It also:

  • Uses has_role? for named-role checks in the admin user form.
  • Preloads roles when loading users for admin user pages that render the role collection.
  • Adds regression coverage for users with roles, users without roles, invalid session salts, and admin user role preloading.

Credit

y7nieSEl5, she/her

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant