mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-07 21:51:42 +08:00
init project
This commit is contained in:
8
app/constraint/admin_constraint.rb
Normal file
8
app/constraint/admin_constraint.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
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
|
||||
11
app/constraint/react_constraint.rb
Normal file
11
app/constraint/react_constraint.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class ReactConstraint
|
||||
|
||||
|
||||
def matches?(request)
|
||||
# stuff
|
||||
#
|
||||
!File.exists?(File.join(Rails.root, "public", request.fullpath.split('?').first))
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user