Skip to content

Commit

Permalink
Merge pull request #1517 from mlibrary/DEEPBLUE-325-tombstoned-deposi…
Browse files Browse the repository at this point in the history
…ts-who-unwanted-fields-to-unauthenticated-users

DEEPBLUE-325 - Tombstoned deposits show unwanted fields to unauthenti…
  • Loading branch information
fritzfreiheit authored Mar 22, 2024
2 parents 00bf10c + 2535306 commit df5271e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions app/presenters/hyrax/presents_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def attribute_to_html(field, options = {}) # monkey override
return
end

return if options[:anonymous_hide]

value = send(field)
renderer = renderer_for(field, options).new(field, value, options)
::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,
Expand Down
18 changes: 10 additions & 8 deletions app/views/hyrax/base/_attribute_rows.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

<span itemprop="url" class="hide"><%= presenter.work_url %></span>

<!-- tr><th>Anonymous show?</th><td><ul class='tabular_list'><li><%= presenter.anonymous_show? %></li></ul></td></tr -->

<tr>
<th>Methodology</th>
<td>
Expand Down Expand Up @@ -76,8 +78,8 @@

<%= presenter.attribute_to_html(:doi, label: t('show.labels.doi'), work_type: "DataSet", render_as: :doi, itemprop: "identifier" ) %>

<% if presenter.current_ability.admin? %>
<%= presenter.attribute_to_html(:ticket, include_empty: true, label: t('show.labels.ticket') ) %>
<% if presenter.current_ability.admin? && !presenter.anonymous_show? %>
<%= presenter.attribute_to_html(:ticket, include_empty: true, label: t('show.labels.ticket'), anonymous_hide: presenter.anonymous_show? ) %>
<% end %>

<span itemprop="license">
Expand All @@ -93,14 +95,14 @@
<%= presenter.attribute_to_html(:rights_statement, render_as: :rights_statement ) %>

<% if presenter.current_ability.admin? && !presenter.tombstone_permissions_hack? %>
<%= presenter.attribute_to_html(:prior_identifier, label: t('show.labels.prior_identifier') ) %>
<%= presenter.attribute_to_html(:prior_identifier, label: t('show.labels.prior_identifier'), anonymous_hide: presenter.anonymous_show? ) %>
<% end %>

<% if presenter.current_ability.admin? %>
<%= presenter.attribute_to_html(:read_users, label: t('show.labels.read_users') ) %>
<%= presenter.attribute_to_html(:edit_users, label: t('show.labels.edit_users') ) %>
<%= presenter.attribute_to_html(:read_groups, label: t('show.labels.read_groups') ) %>
<%= presenter.attribute_to_html(:edit_groups, label: t('show.labels.read_groups') ) %>
<% if presenter.current_ability.admin? && !presenter.anonymous_show? %>
<%= presenter.attribute_to_html(:read_users, label: t('show.labels.read_users'), anonymous_hide: presenter.anonymous_show? ) %>
<%= presenter.attribute_to_html(:edit_users, label: t('show.labels.edit_users'), anonymous_hide: presenter.anonymous_show? ) %>
<%= presenter.attribute_to_html(:read_groups, label: t('show.labels.read_groups'), anonymous_hide: presenter.anonymous_show? ) %>
<%= presenter.attribute_to_html(:edit_groups, label: t('show.labels.read_groups'), anonymous_hide: presenter.anonymous_show? ) %>
<% end %>

<%# "secondary" attributes %>
Expand Down

0 comments on commit df5271e

Please sign in to comment.