diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-06-13 19:31:43 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-06-13 19:31:43 +0000 |
commit | 2f53246c137e1dfead1c5b63d4f634082c8e75a8 (patch) | |
tree | 4a63a87e7b71b7cc7c2b52aceca60fe856311786 /app/models/user.rb | |
parent | 07d88851bf82f5d3fd5761157d64e7e4a8510b78 (diff) | |
download | redmine-2f53246c137e1dfead1c5b63d4f634082c8e75a8.tar.gz redmine-2f53246c137e1dfead1c5b63d4f634082c8e75a8.zip |
Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11967 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index f8813b167..94bda6a37 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -445,7 +445,7 @@ class User < Principal # Returns the user's bult-in role def builtin_role - @builtin_role ||= (logged? ? Role.non_member : Role.anonymous) + @builtin_role ||= Role.non_member end # Return user's roles for project @@ -453,14 +453,8 @@ class User < Principal roles = [] # No role on archived projects return roles if project.nil? || project.archived? - if logged? - # Find project membership - membership = membership(project) - if membership - roles = membership.roles - else - roles << builtin_role - end + if membership = membership(project) + roles = membership.roles else roles << builtin_role end @@ -720,7 +714,16 @@ class AnonymousUser < User UserPreference.new(:user => self) end - def member_of?(project) + # Returns the user's bult-in role + def builtin_role + @builtin_role ||= Role.anonymous + end + + def membership(*args) + nil + end + + def member_of?(*args) false end |