Class: SessionController

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

Constant Summary

Constants included from Searchable

Searchable::ABSTRACT

Instance Method Summary collapse

Methods inherited from ApplicationController

#archivesspace, can_access?, permission_mappings, set_access_control

Methods included from JsonHelper

#merge_notes, #process_json_notes

Methods included from Searchable

#default_search_opts, #get_filter_years, #handle_results, #html_notes, #process_results, #process_search_results, #repo_context, #search_terms, #set_up_advanced_search, #set_up_and_run_search, #set_up_search, #strip_facet_fields

Methods included from HandleFaceting

#fetch_only_facets, #get_pretty_facet_value, #strip_facets

Methods included from ManipulateNode

#inheritance, #process_mixed_content, #strip_mixed_content

Instance Method Details

#become_userObject



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

#check_sessionObject

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

#has_sessionObject



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

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

#loginObject



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

#login_inlineObject



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

#logoutObject



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

def logout
  reset_session
  redirect_to :root
end

#select_userObject



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

def select_user
end