diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 7a740ca11..1f8e393bf 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -15,6 +15,9 @@ def options_for_roles end def user_has_no_rights?(user) + return false if user.root? + return false if user.editor? + return false if user.tag_admin? return false if user.neighbourhood_admin? return false if user.partner_admin? diff --git a/test/integration/admin/home_integration_test.rb b/test/integration/admin/home_integration_test.rb index b55783773..469bccc48 100644 --- a/test/integration/admin/home_integration_test.rb +++ b/test/integration/admin/home_integration_test.rb @@ -7,18 +7,30 @@ class AdminHomeIntegrationTest < ActionDispatch::IntegrationTest setup do @admin = create(:root) + @citizen = create(:citizen) end test "Admin home page can't be accessed without a login" do @default_site = create_default_site get "http://admin.lvh.me" assert_redirected_to "http://admin.lvh.me/users/sign_in" + end + test "Admin can access page when logged in" do sign_in @admin get "http://admin.lvh.me" assert_response :success + assert_select 'title', text: "Dashboard | PlaceCal Admin" + end + + test "Blank citizen gets a 'no content' warning" do + sign_in @citizen + get "http://admin.lvh.me" + assert_response :success + assert_select 'title', text: "Dashboard | PlaceCal Admin" assert_select 'h1', text: "Missing Permissions" end + end