Skip to content

Commit 56e7201

Browse files
authored
Add roles column (#5040)
* Add roles column * Test roles and resources column * Display role and specific org or partner
1 parent e8b521f commit 56e7201

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

app/views/admin/users/_list.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<table class="table">
22
<thead>
33
<tr>
4-
<th>Banks and Partners</th>
4+
<th>Roles</th>
55
<th>Name</th>
66
<th>Email</th>
77
<th class="text-right">Actions</th>
@@ -11,7 +11,7 @@
1111
<% @users.each do |user| %>
1212
<tr>
1313
<td>
14-
<%= user.roles.map { |role| role.resource&.name }.compact.uniq.sort.join(', ') %>
14+
<%= user.roles.map { |role| "#{role.name} (#{role.resource&.name.presence || "N/A"})" }.compact.uniq.sort.join(", ") %>
1515
</td>
1616
<td><%= user.display_name %></td>
1717
<td><%= user.email %></td>

spec/requests/admin/users_requests_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
end
1313

1414
describe "GET #index" do
15-
it "renders index template and shows banks and partners correctly" do
15+
it "renders index template and shows roles and resources correctly" do
1616
AddRoleService.call(user_id: user.id, resource_type: Role::ORG_ADMIN, resource_id: organization.id)
1717
get admin_users_path
1818

1919
expect(response).to render_template(:index)
2020

2121
page = Nokogiri::HTML(response.body)
22-
banks_and_partners = page.at_xpath("//*[contains(text(), \"#{user.email}\")]/../td[1]").text.strip
23-
expect(banks_and_partners).to eq("Org ABC, Partner XYZ")
22+
roles_and_resources = page.at_xpath("//*[contains(text(), \"#{user.email}\")]/../td[1]").text.strip
23+
expect(roles_and_resources).to eq("org_admin (Org ABC), org_user (Org ABC), partner (Partner XYZ)")
2424
end
2525
end
2626

0 commit comments

Comments
 (0)