aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/admin_controller.rb
blob: 5810b4b046c51c307651dfe2b34c2168fe07a1cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# controllers/admin.rb:
# All admin controllers are dervied from this.
#
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
# $Id: admin_controller.rb,v 1.25 2009-06-23 13:52:25 francis Exp $


class AdminController < ApplicationController
    layout "admin"
    before_filter :assign_http_auth_user

    # Always give full stack trace for admin interface
    def local_request?
        true
    end

    # Expire cached attachment files for a request
    def expire_for_request(info_request)
        # So is using latest censor rules
        info_request.reload

        # clear out cached entries
        for incoming_message in info_request.incoming_messages
            for attachment in incoming_message.get_attachments_for_display
                expire_page :controller => 'request', :action => "get_attachment", :id => info_request.id,
                    :incoming_message_id => incoming_message.id, 
                    :part => attachment.url_part_number, :file_name => attachment.display_filename
                expire_page :controller => 'request', :action => "get_attachment_as_html", :id => info_request.id,
                    :incoming_message_id => incoming_message.id, 
                    :part => attachment.url_part_number, :file_name => attachment.display_filename
            end
        end
    end


end