aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/info_request.rb10
-rw-r--r--app/models/user.rb8
2 files changed, 11 insertions, 7 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 9d14e70d2..aa9b49c83 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -24,7 +24,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: info_request.rb,v 1.196 2009-06-27 02:25:31 francis Exp $
+# $Id: info_request.rb,v 1.197 2009-06-30 14:28:26 francis Exp $
require 'digest/sha1'
require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian')
@@ -819,10 +819,10 @@ public
end
def user_can_view?(user)
- return self.prominence != 'hidden'
- # || self.is_owning_user?(user) # XXX this doesn't work, as have to
- # mess with caching of HTML versions - need to change from using
- # caches_pages in the request controller first.
+ if self.prominence == 'hidden'
+ return User.view_hidden_requests?(user)
+ end
+ return true
end
# This is called from cron regularly.
diff --git a/app/models/user.rb b/app/models/user.rb
index 13b2c58d0..03a076c24 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -23,7 +23,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.95 2009-06-26 14:28:38 francis Exp $
+# $Id: user.rb,v 1.96 2009-06-30 14:28:26 francis Exp $
require 'digest/sha1'
@@ -219,7 +219,11 @@ class User < ActiveRecord::Base
def self.owns_every_request?(user)
!user.nil? && user.owns_every_request?
end
-
+
+ def self.view_hidden_requests?(user)
+ !user.nil? && user.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'