Class: Phcscriptcdnpro::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/phcscriptcdnpro/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#authrocket_membership_infoObject



34
35
36
# File 'app/controllers/phcscriptcdnpro/application_controller.rb', line 34

def authrocket_membership_info
  AuthRocket::Membership.all(user_id: current_user.id).first
end

#current_userObject



24
25
26
# File 'app/controllers/phcscriptcdnpro/application_controller.rb', line 24

def current_user
  @_current_user ||= AuthRocket::Session.from_token(session[:ar_token]).try(:user)
end

#new_login_urlObject



29
30
31
# File 'app/controllers/phcscriptcdnpro/application_controller.rb', line 29

def 
  ENV['AUTHROCKET_LOGIN_URL']
end

#require_userObject

AuthRocket Definitions



16
17
18
19
20
21
22
# File 'app/controllers/phcscriptcdnpro/application_controller.rb', line 16

def require_user
  unless current_user
    params.permit!
    session[:last_url] = request.get? ? url_for(params) : url_for
    redirect_to 
  end
end

#user_for_paper_trailObject

Papertrail Whodunnit Username



39
40
41
42
# File 'app/controllers/phcscriptcdnpro/application_controller.rb', line 39

def user_for_paper_trail
  # Default is: current_user rescue nil
  current_user ? current_user.username : 'Public user'
end