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

Returns a new instance of 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

#delete_cookie!(key, domain) ⇒ Object



51
52
53
# File 'lib/mumukit/login/controller.rb', line 51

def delete_cookie!(key, domain)
  @framework.delete_cookie! key, domain, @native
end

#envObject



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

def env
  @framework.env @native
end

#mucookieObject



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

def mucookie
  @mucookie ||= Mumukit::Login::Mucookie.new self
end


47
48
49
# File 'lib/mumukit/login/controller.rb', line 47

def read_cookie(key)
  @framework.read_cookie key, @native
end

#redirect!(path) ⇒ Object



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

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

#render_html!(html) ⇒ Object



39
40
41
# File 'lib/mumukit/login/controller.rb', line 39

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

#requestObject



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

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

#sessionObject



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

def session
  request.session
end

#shared_sessionObject



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

def shared_session
  if env['HTTP_AUTHORIZATION']
    Mumukit::Login::TokenSharedSession.new env
  else
    Mumukit::Login::MucookieSharedSession.new mucookie
  end
end

#url_for(path) ⇒ Object



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

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

#write_cookie!(key, value) ⇒ Object



43
44
45
# File 'lib/mumukit/login/controller.rb', line 43

def write_cookie!(key, value)
  @framework.write_cookie! key, value, @native
end