Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11967 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
07d88851bf
commit
2f53246c13
@ -445,7 +445,7 @@ class User < Principal
|
|||||||
|
|
||||||
# Returns the user's bult-in role
|
# Returns the user's bult-in role
|
||||||
def builtin_role
|
def builtin_role
|
||||||
@builtin_role ||= (logged? ? Role.non_member : Role.anonymous)
|
@builtin_role ||= Role.non_member
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return user's roles for project
|
# Return user's roles for project
|
||||||
@ -453,14 +453,8 @@ class User < Principal
|
|||||||
roles = []
|
roles = []
|
||||||
# No role on archived projects
|
# No role on archived projects
|
||||||
return roles if project.nil? || project.archived?
|
return roles if project.nil? || project.archived?
|
||||||
if logged?
|
if membership = membership(project)
|
||||||
# Find project membership
|
roles = membership.roles
|
||||||
membership = membership(project)
|
|
||||||
if membership
|
|
||||||
roles = membership.roles
|
|
||||||
else
|
|
||||||
roles << builtin_role
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
roles << builtin_role
|
roles << builtin_role
|
||||||
end
|
end
|
||||||
@ -720,7 +714,16 @@ class AnonymousUser < User
|
|||||||
UserPreference.new(:user => self)
|
UserPreference.new(:user => self)
|
||||||
end
|
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
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user