Skip to content

Commit

Permalink
Prevent Users tab from disappearing (#4401)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeticiaErrandonea authored Jul 1, 2024
1 parent 34329cf commit 6860604
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/lib/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions spec/system/admin/projects_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6860604

Please sign in to comment.