From f0e7dd7b095a50d86798aa71f81515765eee9a22 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 9 Dec 2019 11:20:07 +0800 Subject: [PATCH] =?UTF-8?q?sidekiq=E7=9A=84seesion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/constraint/admin_constraint.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/constraint/admin_constraint.rb b/app/constraint/admin_constraint.rb index 360efde20..2cf5649a7 100644 --- a/app/constraint/admin_constraint.rb +++ b/app/constraint/admin_constraint.rb @@ -1,7 +1,8 @@ class AdminConstraint def matches?(request) - return false unless request.session[:"www_user_id"] - user = User.find request.session[:"www_user_id"] + 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 \ No newline at end of file