Moved logic relative to project status from User to Project model (#3640).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9886 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-06-25 18:44:25 +00:00
parent 7fb2ddefde
commit 2ceb6b8230
2 changed files with 10 additions and 6 deletions
-5
View File
@@ -455,12 +455,7 @@ class User < Principal
# or falls back to Non Member / Anonymous permissions depending if the user is logged
def allowed_to?(action, context, options={}, &block)
if context && context.is_a?(Project)
# No action allowed on archived projects
return false if context.archived?
# No action allowed on disabled modules
return false unless context.allows_to?(action)
# No write action allowed on closed projects
return false unless context.active? || Redmine::AccessControl.read_action?(action)
# Admin users are authorized for anything else
return true if admin?