-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5399 from nebulab/rainerd/fix/cancancan-action-na…
…me-symbol [Admin] Ensure `action_name` is passed as symbol for `cancancan` authorization
- Loading branch information
Showing
4 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class="p-4"> | ||
<h1 class="text-3xl font-semibold text-solidusRed mb-4"><%= t('solidus_admin.errors.authorization.access_denied.title') %></h1> | ||
<p class="text-lg text-gray-700"><%= t('solidus_admin.errors.authorization.access_denied.description') %></p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
en: | ||
solidus_admin: | ||
errors: | ||
authorization: | ||
access_denied: | ||
title: "Access Denied" | ||
description: "You are not authorized to access this page." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,10 +15,22 @@ def index | |
allow_any_instance_of(SolidusAdmin::BaseController).to receive(:spree_current_user).and_return(nil) | ||
end | ||
|
||
it "redirects to unauthorized" do | ||
it "redirects to unauthorized for no user" do | ||
get :index | ||
expect(response).to redirect_to '/unauthorized' | ||
end | ||
|
||
context "with a user without update permission" do | ||
before do | ||
user = create(:user, email: '[email protected]') | ||
allow_any_instance_of(SolidusAdmin::BaseController).to receive(:spree_current_user).and_return(user) | ||
end | ||
|
||
it "redirects to unauthorized" do | ||
get :index | ||
expect(response).to have_http_status(:forbidden) | ||
end | ||
end | ||
end | ||
|
||
context "successful request" do | ||
|