diff --git a/app/lib/ability.rb b/app/lib/ability.rb index 017e440ee4..f03bb82766 100644 --- a/app/lib/ability.rb +++ b/app/lib/ability.rb @@ -53,7 +53,9 @@ def administrator_abilities(user, resource) cannot [:manage_accounts, :manage_billing], Facility.cross_facility end unless user.account_manager? - cannot :manage, User unless resource.is_a?(Facility) + # TODO: Refactor + # We think this is here to keep the Users tab visible. See LinkCollection#admin_users. + cannot :manage, User unless resource.is_a?(Facility) || resource.is_a?(Projects::Project) if SettingsHelper.feature_off?(:create_users) cannot([:edit, :update], User) end diff --git a/spec/system/admin/projects_show_spec.rb b/spec/system/admin/projects_show_spec.rb index adafc3aa39..639bc4f576 100644 --- a/spec/system/admin/projects_show_spec.rb +++ b/spec/system/admin/projects_show_spec.rb @@ -156,4 +156,19 @@ end end end + + context "global admin tabs" do + # https://pm.tablexi.com/issues/162319 + let(:admin) { create(:user, :administrator) } + + before do + login_as admin + + visit facility_project_path(facility, active_project) + end + + it "has a link to Users tab" do + expect(page).to have_link("Users", href: facility_users_path(facility)) + end + end end