Skip to content

Commit 3d79791

Browse files
[Auditor] Disable edit security UI (Part 2) (#11900)
## Summary of the problem <!-- Why are these changes being made? What problem does it solve? Link any related issues to provide more details. --> Buttons and form elements weren't disabled for auditors. ## Describe your changes <!-- Explain your thought process to the solution and provide a quick summary of the changes. --> <!-- If there are any visual changes, please attach images, videos, or gifs. --> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent ed40432 commit 3d79791

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

app/views/users/_oauth_authorization.erb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<span class="bold flex items-center">
44
<span><%= authorization.application.name %></span> <span class="badge bg-info ml1">App</span>
55
</span>
6-
<%= link_to revoke_oauth_application_users_path(authorization.application.id), method: :delete, class: "muted tooltipped tooltipped--w z5", 'aria-label': "Sign out of this app" do %>
6+
<%= link_to revoke_oauth_application_users_path(authorization.application.id), method: :delete, class: "muted tooltipped tooltipped--w z5", 'aria-label': "Sign out of this app", disabled: do %>
77
<%= inline_icon "door-leave", size: home_action_size %>
88
<% end %>
99
</span>
@@ -37,7 +37,8 @@
3737
<td>
3838
<% if token.expires_in %>
3939
<%= link_to make_authorization_eternal_users_path(id: token.id), method: :post,
40-
class: "btn bg-success py1 px2 h4" do %>
40+
class: "btn bg-success py1 px2 h4",
41+
disabled: !policy(token).make_eternal? do %>
4142
<%= inline_icon "clock", size: home_action_size %>
4243
Make eternal
4344
<% end %>

app/views/users/edit_security.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
<% if session.is_a? UserSession %>
167167
<%= render "user_session", session: %>
168168
<% elsif session.respond_to? :authorization_count %>
169-
<%= render "oauth_authorization", authorization: session %>
169+
<%= render "oauth_authorization", authorization: session, disabled: %>
170170
<% end %>
171171
<% end %>
172172
</div>
@@ -181,7 +181,7 @@
181181
<% if session.is_a? UserSession %>
182182
<%= render "user_session", session: %>
183183
<% elsif session.respond_to? :authorization_count %>
184-
<%= render "oauth_authorization", authorization: session %>
184+
<%= render "oauth_authorization", authorization: session, disabled: %>
185185
<% end %>
186186
<% end %>
187187
</div>

app/views/webauthn_credentials/_webauthn_credential.html.erb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
<span class="secondary">No name</span>
1414
<% end %>
1515
</span>
16-
<%= link_to user_webauthn_credential_path(webauthn_credential.user, webauthn_credential), method: :delete, class: "muted tooltipped tooltipped--w z5", 'aria-label': "Delete this security key" do %>
16+
<%= link_to user_webauthn_credential_path(webauthn_credential.user, webauthn_credential),
17+
method: :delete,
18+
class: "muted tooltipped tooltipped--w z5",
19+
'aria-label': "Delete this security key",
20+
disabled: !policy(webauthn_credential).destroy? do %>
21+
1722
<%= inline_icon "delete", size: home_action_size %>
1823
<% end %>
1924
</span>

0 commit comments

Comments
 (0)