mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-15 12:44:03 +00:00
Use role caching for Rolify to avoid N+1 queries
Resolves #2018 See https://github.com/RolifyCommunity/rolify#cached-roles-to-avoid-n1-issue
This commit is contained in:
parent
30ba7b133b
commit
98defe2d0f
13 changed files with 44 additions and 35 deletions
|
|
@ -13,10 +13,10 @@ module Admin
|
|||
redirect_to sign_in_path
|
||||
return false
|
||||
end
|
||||
unless (current_user.has_role? :organizer, :any) || (current_user.has_role? :cfp, :any) ||
|
||||
(current_user.has_role? :info_desk, :any) || (current_user.has_role? :organization_admin, :any) ||
|
||||
(current_user.has_role? :volunteers_coordinator, :any) ||
|
||||
(current_user.has_role? :track_organizer, :any) || current_user.is_admin
|
||||
unless (current_user.has_cached_role? :organizer, :any) || (current_user.has_cached_role? :cfp, :any) ||
|
||||
(current_user.has_cached_role? :info_desk, :any) || (current_user.has_cached_role? :organization_admin, :any) ||
|
||||
(current_user.has_cached_role? :volunteers_coordinator, :any) ||
|
||||
(current_user.has_cached_role? :track_organizer, :any) || current_user.is_admin
|
||||
raise CanCan::AccessDenied.new('You are not authorized to access this page.')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue