Streamline of access checks.
This commit is contained in:
parent
ddbab392ef
commit
0933df82a4
1 changed files with 8 additions and 11 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue