Code cleanup.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11967 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-06-13 19:31:43 +00:00
parent 07d88851bf
commit 2f53246c13
1 changed files with 13 additions and 10 deletions

View File

@ -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