diff options
author | francis <francis> | 2008-09-24 12:59:26 +0000 |
---|---|---|
committer | francis <francis> | 2008-09-24 12:59:26 +0000 |
commit | 704a29834ac98c69583a7968fc259ba59a92743d (patch) | |
tree | 31f59706e60f34226abf08fcc41c07c8f682997c | |
parent | e89bd1f6a65c268b97a0e2b9ccbe8589f2fe3963 (diff) |
Let super users change status of requires_admin requests from main site
-rw-r--r-- | app/controllers/request_controller.rb | 10 | ||||
-rw-r--r-- | app/models/user.rb | 6 | ||||
-rw-r--r-- | app/views/request/_describe_state.rhtml | 2 | ||||
-rw-r--r-- | app/views/request/show.rhtml | 2 | ||||
-rw-r--r-- | config/httpd.conf | 6 | ||||
-rw-r--r-- | todo.txt | 6 |
6 files changed, 24 insertions, 8 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 8259c401b..96e713655 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: request_controller.rb,v 1.113 2008-09-22 14:13:40 francis Exp $ +# $Id: request_controller.rb,v 1.114 2008-09-24 12:59:27 francis Exp $ class RequestController < ApplicationController @@ -29,6 +29,9 @@ class RequestController < ApplicationController @last_info_request_event_id = last_event.nil? ? nil : last_event.id @new_responses_count = @events_needing_description.select {|i| i.event_type == 'response'}.size + # special case that an admin user can edit requires_admin requests + @requires_admin_describe = (@info_request.described_state == 'requires_admin') && !authenticated_user.nil? && authenticated_user.requires_admin_power? + # Sidebar stuff limit = 3 # ... requests that have similar imporant terms @@ -194,7 +197,10 @@ class RequestController < ApplicationController def describe_state @info_request = InfoRequest.find(params[:id]) - if not @info_request.awaiting_description + # special case that an admin user can edit requires_admin requests + @requires_admin_describe = (@info_request.described_state == 'requires_admin') && !authenticated_user.nil? && authenticated_user.requires_admin_power? + + if !@info_request.awaiting_description && !@requires_admin_describe flash[:notice] = "The status of this request is up to date." if !params[:submitted_describe_state].nil? flash[:notice] = "The status of this request was made up to date elsewhere while you were filling in the form." diff --git a/app/models/user.rb b/app/models/user.rb index 558c2ad3f..ba7e6f72b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -22,7 +22,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user.rb,v 1.71 2008-09-22 22:16:37 francis Exp $ +# $Id: user.rb,v 1.72 2008-09-24 12:59:27 francis Exp $ require 'digest/sha1' @@ -187,6 +187,10 @@ class User < ActiveRecord::Base def owns_every_request? self.admin_level == 'super' end + # Can the user edit status of requires_admin requests from main website? + def requires_admin_power? + self.admin_level == 'super' + end # Does the user get "(admin)" links on each page on the main site? def admin_page_links? self.admin_level == 'super' diff --git a/app/views/request/_describe_state.rhtml b/app/views/request/_describe_state.rhtml index a4f573e10..0c29ca01c 100644 --- a/app/views/request/_describe_state.rhtml +++ b/app/views/request/_describe_state.rhtml @@ -1,4 +1,4 @@ -<% if @is_owning_user %> +<% if @is_owning_user || @requires_admin_describe %> <% form_for(:incoming_message, @info_request, :url => describe_state_url(:id => @info_request.id)) do |f| %> <h2>What is the status of this request now?</h2> <hr> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index 02eb820e6..b77e3c464 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -1,6 +1,6 @@ <% @title = h(@info_request.title) %> -<% if @info_request.awaiting_description %> +<% if @info_request.awaiting_description || @requires_admin_describe %> <div class="describe_state_form"> <%= render :partial => 'describe_state', :locals => { :id_suffix => "1" } %> </div> diff --git a/config/httpd.conf b/config/httpd.conf index 5d6a40a87..33227ae3a 100644 --- a/config/httpd.conf +++ b/config/httpd.conf @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org # -# $Id: httpd.conf,v 1.14 2008-09-06 07:27:59 francis Exp $ +# $Id: httpd.conf,v 1.15 2008-09-24 12:59:28 francis Exp $ # This is needed for the PHP spell checker <Location /fcgi> @@ -15,8 +15,8 @@ </Location> RewriteEngine On -#RewriteLog /var/log/apache/rewrite.log -#RewriteLogLevel 3 +RewriteLog /var/log/apache/rewrite.log +RewriteLogLevel 9 # Make a file down.html in the DocumentRoot bring down the whole site and # display itself. @@ -6,8 +6,14 @@ Next This doesn't work: http://www.whatdotheyknow.com/search/status:waiting_classification/ +Gah, Apache hates slashes in search results, and in general %2F in URls: + http://whatdotheyknow.cat/x%2F +It doesn't get through to rails at all. + Performance: Remove loading of public body tags from every info request load + Completed in 15.53564 (0 reqs/sec) | Rendering: 1.03024 (6%) | DB: 14.46186 (93%) | 200 OK [http://www.whatdotheyknow.com/body/list/n] + Make it not single threaded Upload Julian's large Cambridgeshire contract |