Skip to content

Commit

Permalink
Only allow superusers (a.k.a. "Admins") to edit from the show screen (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bess authored Dec 11, 2024
1 parent 842896e commit a37a477
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/views/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

<div class="details">
<h2>Roles
<% if @project_eligible_to_edit && current_user.eligible_sponsor? %>
<%# Per ticket #1114 only superusers have edit access %>
<% if @project_eligible_to_edit && current_user.superuser %>
<%= link_to "Edit", edit_project_path(@project.id), id:"revisible-heading", class: "btn btn-primary btn-sm" %>
<% end %>
</h2>
Expand Down Expand Up @@ -42,7 +43,8 @@

<div class="details">
<h2>Project Description
<% if @project_eligible_to_edit && current_user.eligible_sponsor? %>
<%# Per ticket #1114 only superusers have edit access %>
<% if @project_eligible_to_edit && current_user.superuser %>
<%= link_to "Edit", edit_project_path(@project.id), id:"revisible-heading", class: "btn btn-primary btn-sm" %>
<% end %>
</h2>
Expand Down
3 changes: 2 additions & 1 deletion spec/system/project_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@

expect(page).not_to have_content(pending_text)
expect(page).to have_css ".approved"
expect(page).to have_selector(:link_or_button, "Edit") # button next to role and description heading
# Per ticket #1114 sponsor users no longer have edit access
expect(page).not_to have_selector(:link_or_button, "Edit") # button next to role and description heading
expect(page).to have_selector(:link_or_button, "Review Contents")
expect(page).to have_selector(:link_or_button, "Withdraw Project Request")
expect(page).to have_selector(:link_or_button, "Return to Dashboard")
Expand Down

0 comments on commit a37a477

Please sign in to comment.