forked from jasder/forgeplus
8 lines
310 B
Ruby
8 lines
310 B
Ruby
|
class AdminConstraint
|
||
|
def matches?(request)
|
||
|
laboratory = Laboratory.first
|
||
|
return false unless request.session[:"#{laboratory.try(:identifier).split('.').first}_user_id"]
|
||
|
user = User.find request.session[:"#{laboratory.try(:identifier).split('.').first}_user_id"]
|
||
|
user && user.admin?
|
||
|
end
|
||
|
end
|