Sha256: cd4d7de9ce32a7f24244b8d30f2307f55f4ceb239ba2dfd655e41f9166f0952e
Contents?: true
Size: 671 Bytes
Versions: 23
Compression:
Stored size: 671 Bytes
Contents
require 'rhoconnect/middleware/helpers' module Rhoconnect module Middleware class CurrentUser def initialize(app) @app = app end def call(env) #puts "env is *** #{env.inspect}" env[Rhoconnect::CURRENT_USER] = extract_current_user(env) @app.call(env) end def extract_current_user(env) user = nil if User.is_exist?(env['rack.session'][:login]) user = User.load(env['rack.session'][:login]) end if user and (user.admin == 1 || env['rack.session'][:app_name] == APP_NAME) user else nil end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems