Modify admin layout to only manage tenants and admins
We only want to render the account link and login items in the header. And we want only render the Multitenancy and Administrators sections in the admin sidebar. We include the administrators management so it's possible to give permissions to other users to manage tenants. In order to restrict access to other sections by typing the URL or following a link, we're only enabling the rest of the routes when we aren't in the multitenancy management mode.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Admin::MenuComponent, controller: Admin::NewslettersController do
|
||||
describe Admin::MenuComponent, :admin, controller: Admin::NewslettersController do
|
||||
it "disables all buttons when JavaScript isn't available" do
|
||||
render_inline Admin::MenuComponent.new
|
||||
|
||||
@@ -20,6 +20,17 @@ describe Admin::MenuComponent, controller: Admin::NewslettersController do
|
||||
expect(page).to have_css "button[aria-expanded='false']", exact_text: "Settings"
|
||||
end
|
||||
|
||||
it "only renders the multitenancy and administrators sections in multitenancy management mode" do
|
||||
allow(Rails.application.config).to receive(:multitenancy_management_mode).and_return(true)
|
||||
|
||||
render_inline Admin::MenuComponent.new
|
||||
|
||||
expect(page).to have_css "#admin_menu"
|
||||
expect(page).to have_link "Multitenancy"
|
||||
expect(page).to have_link "Administrators"
|
||||
expect(page).to have_link count: 2
|
||||
end
|
||||
|
||||
describe "#polls_link" do
|
||||
it "is marked as current when managing poll options",
|
||||
controller: Admin::Poll::Questions::OptionsController do
|
||||
|
||||
Reference in New Issue
Block a user