Class: Mumukit::Login::Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/mumukit/login/controller.rb

Instance Method Summary collapse

Constructor Details

#initialize(framework, native) ⇒ Controller



2
3
4
5
# File 'lib/mumukit/login/controller.rb', line 2

def initialize(framework, native)
  @framework = framework
  @native = native
end

Instance Method Details

#current_user_storeObject



7
8
9
10
11
12
13
# File 'lib/mumukit/login/controller.rb', line 7

def current_user_store
  if env['HTTP_AUTHORIZATION']
    Mumukit::::JWTCurrentUserStore.new self
  else
    Mumukit::::SessionCurrentUserStore.new self
  end
end

#envObject



15
16
17
# File 'lib/mumukit/login/controller.rb', line 15

def env
  @framework.env @native
end

#redirect!(path) ⇒ Object



19
20
21
# File 'lib/mumukit/login/controller.rb', line 19

def redirect!(path)
  @framework.redirect!(path, @native)
end

#render_html!(html) ⇒ Object



23
24
25
# File 'lib/mumukit/login/controller.rb', line 23

def render_html!(html)
  @framework.render_html!(html, @native)
end

#requestObject



31
32
33
# File 'lib/mumukit/login/controller.rb', line 31

def request
  Rack::Request.new(env)
end

#sessionObject



35
36
37
# File 'lib/mumukit/login/controller.rb', line 35

def session
  request.session
end

#url_for(path) ⇒ Object



27
28
29
# File 'lib/mumukit/login/controller.rb', line 27

def url_for(path)
  URI.join(request.base_url, path).to_s
end