Skip to content

Commit

Permalink
List FOI Attachments on admin page
Browse files Browse the repository at this point in the history
When handling data breaches we need to find the hexdigest of the
attachment to ensure it gets purged from all caches / backups etc.

Its quite hard to do this – even from the console – and any console
commands are prone to error. Its easier to just show the associated
attachments on the admin interface, along with some less user-friendly
information that's useful for admin purposes.
  • Loading branch information
garethrees committed Aug 8, 2019
1 parent d052082 commit 76bab0b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
30 changes: 30 additions & 0 deletions app/views/admin_incoming_message/_foi_attachments.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<fieldset id="attachments" class="form-horizontal">
<legend>Attachments</legend>

<% if foi_attachments.any? %>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Filename</th>
<th>Content Type</th>
<th>Hexdigest</th>
<th>Display Size</th>
</tr>
</thead>
<tbody>
<% foi_attachments.each do |attachment| %>
<tr>
<td><tt><%= attachment.id %></tt></td>
<td><tt><%= attachment.filename %></tt></td>
<td><tt><%= attachment.content_type %></tt></td>
<td><tt><%= attachment.hexdigest %></tt></td>
<td><tt><%= attachment.display_size %></tt></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p>No attachments.</p>
<% end %>
</fieldset>
3 changes: 3 additions & 0 deletions app/views/admin_incoming_message/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@
</div>
<% end %>
</fieldset>

<%= render partial: 'foi_attachments',
locals: { foi_attachments: @incoming_message.foi_attachments } %>

0 comments on commit 76bab0b

Please sign in to comment.