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 14, 2019
1 parent 92ba759 commit 392a2da
Show file tree
Hide file tree
Showing 3 changed files with 35 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 } %>
2 changes: 2 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Highlighted Features

* Show incoming message attachments in admin interface (Gareth Rees)

## Upgrade Notes

### Changed Templates
Expand Down

0 comments on commit 392a2da

Please sign in to comment.