Class: SessionController

Inherits:
ApplicationController show all
Defined in:
frontend/app/controllers/session_controller.rb

Instance Method Summary (collapse)

Methods inherited from ApplicationController

can_access?, permission_mappings, set_access_control

Instance Method Details

- (Object) become_user



29
30
31
32
33
34
35
36
37
# File 'frontend/app/controllers/session_controller.rb', line 29

def become_user
  if User.become_user(self, params[:username])
    flash[:success] = I18n.t("become-user.success")
    redirect_to :controller => :welcome, :action => :index
  else
    flash[:error] = I18n.t("become-user.failed")
    redirect_to :controller => :session, :action => :select_user
  end
end

- (Object) check_session

let a trusted app (i.e., public catalog) know if a user should see links back to this editing interface



48
49
50
51
52
53
54
55
56
57
# File 'frontend/app/controllers/session_controller.rb', line 48

def check_session
  response.headers['Access-Control-Allow-Origin'] = AppConfig[:public_proxy_url]
  response.headers['Access-Control-Allow-Credentials'] = 'true'

  if session[:session] && params[:uri]
    render json: user_can_edit?(params)
  else
    render json: false
  end
end

- (Object) has_session



60
61
62
# File 'frontend/app/controllers/session_controller.rb', line 60

def has_session
  render :json => {:has_session => !session[:user].nil?}
end

- (Object) login



7
8
9
10
11
12
13
14
15
16
17
# File 'frontend/app/controllers/session_controller.rb', line 7

def 
  backend_session = User.(params[:username], params[:password])

  if backend_session
    User.establish_session(self, backend_session, params[:username])
  end

  load_repository_list

  render :json => {:session => backend_session, :csrf_token => form_authenticity_token}
end

- (Object) login_inline



20
21
22
# File 'frontend/app/controllers/session_controller.rb', line 20

def 
  render_aspace_partial :partial => "shared/modal", :locals => {:title => I18n.t("session.inline_login_title"), :partial => "shared/login", :id => "inlineLoginModal", :klass => "inline-login-modal"}
end

- (Object) logout



40
41
42
43
# File 'frontend/app/controllers/session_controller.rb', line 40

def logout
  reset_session
  redirect_to :root
end

- (Object) select_user



25
26
# File 'frontend/app/controllers/session_controller.rb', line 25

def select_user
end