diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-06-25 17:49:35 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-06-25 17:49:35 +0000 |
commit | ac56c0c99ccd14c7229145fc22d6e9eb13ee0af0 (patch) | |
tree | f54401b77f7195a1795f4a189f9f9d35734c0a2b /lib/redmine/access_control.rb | |
parent | 5961a1e70d1efdfb5c4fd28c20dc8cc4d9a51bac (diff) | |
download | redmine-ac56c0c99ccd14c7229145fc22d6e9eb13ee0af0.tar.gz redmine-ac56c0c99ccd14c7229145fc22d6e9eb13ee0af0.zip |
Ability to close projects (read-only) (#3640).
A new permission (Close/reopen project) is available to give non-admin users the ability to close their projects.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9883 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/access_control.rb')
-rw-r--r-- | lib/redmine/access_control.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/redmine/access_control.rb b/lib/redmine/access_control.rb index 3845fa5e7..b4f3cca73 100644 --- a/lib/redmine/access_control.rb +++ b/lib/redmine/access_control.rb @@ -54,6 +54,16 @@ module Redmine @loggedin_only_permissions ||= @permissions.select {|p| p.require_loggedin?} end + def read_action?(action) + if action.is_a?(Symbol) + perm = permission(action) + !perm.nil? && perm.read? + else + s = "#{action[:controller]}/#{action[:action]}" + permissions.detect {|p| p.actions.include?(s) && !p.read?}.nil? + end + end + def available_project_modules @available_project_modules ||= @permissions.collect(&:project_module).uniq.compact end @@ -93,6 +103,7 @@ module Redmine @actions = [] @public = options[:public] || false @require = options[:require] + @read = options[:read] || false @project_module = options[:project_module] hash.each do |controller, actions| if actions.is_a? Array @@ -115,6 +126,10 @@ module Redmine def require_loggedin? @require && (@require == :member || @require == :loggedin) end + + def read? + @read + end end end end |