diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-07-31 18:47:03 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-09-16 12:25:23 +0100 |
commit | b8965db2ed79e5b79e77716371de02a0297d425e (patch) | |
tree | 0a348bc3b22c9cb6d0a398ccfbfaedcc4a700962 /lib/ability.rb | |
parent | af6bc758faf62eb44e5822ed0eb6c1871db6ac91 (diff) |
Refactor common logic about prominence and access.
Move it into the Ability module.
Diffstat (limited to 'lib/ability.rb')
-rw-r--r-- | lib/ability.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/ability.rb b/lib/ability.rb index 2865ccb1c..f63845e84 100644 --- a/lib/ability.rb +++ b/lib/ability.rb @@ -2,4 +2,15 @@ module Ability def self.can_update_request_state?(user, request) (user && request.is_old_unclassified?) || request.is_owning_user?(user) end -end
\ No newline at end of file + + def self.can_view_with_prominence?(prominence, info_request, user) + if prominence == 'hidden' + return User.view_hidden?(user) + end + if prominence == 'requester_only' + return info_request.is_owning_user?(user) + end + return true + end + +end |