Skip to content

Commit

Permalink
Convert action_name to symbol for CanCanCan authorization
Browse files Browse the repository at this point in the history
Fix CanCanCan authorization by converting action_name to symbol.
In the context of implementing permissions in the Solidus Demo, we identified
that `action_name` in string format doesn't align with
CanCanCan's `authorize!` method expectations.
It needs to be in symbol format to be processed correctly.
This change ensures our authorization logic functions as intended
also for the new solidus admin views.
  • Loading branch information
rainerdema committed Sep 29, 2023
1 parent 689487b commit c2faa57
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def authorize_solidus_admin_user!
subject = authorization_subject

authorize! :admin, subject
authorize! action_name, subject
authorize! action_name.to_sym, subject
end

def authorization_subject
Expand Down

0 comments on commit c2faa57

Please sign in to comment.