Streamline of access checks.

This commit is contained in:
Martin Edenhofer 2015-05-06 10:52:30 +02:00
parent ddbab392ef
commit 0933df82a4

View file

@ -23,25 +23,22 @@ class Sessions::Backend::Collections::Base
# check role based access # check role based access
if self.class.is_role if self.class.is_role
access = nil access = false
self.class.is_role.each {|role| self.class.is_role.each {|role|
if @user.is_role(role) next if !@user.is_role(role)
access = true access = true
end break
} }
return if !access return if !access
end end
if self.class.is_not_role if self.class.is_not_role
access = false
is_role = false
self.class.is_not_role.each {|role| self.class.is_not_role.each {|role|
next if @user.is_role(role)
next if !@user.is_role(role) access = true
is_role = true
break break
} }
return if is_role return if !access
end end
# check timeout # check timeout