Class: Phcscriptcdnpro::ApplicationController

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

Instance Method Summary collapse

Instance Method Details

#current_userObject



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

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

#get_member_profile_infoObject

Grab Member Information



17
18
19
# File 'app/controllers/phcscriptcdnpro/application_controller.rb', line 17

def get_member_profile_info
  @members_profile_info = Member::Profile.find(params[:profile_id])
end

#membership_infoObject



21
22
23
# File 'app/controllers/phcscriptcdnpro/application_controller.rb', line 21

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

#new_login_urlObject



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

def 
  ENV['AUTHROCKET_LOGIN_URL']
  # $ar_login_url
end

#require_userObject

Authentication



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

def require_user
  unless current_user
    session[:last_url] = request.get? ? url_for(params.dup.permit!.except(:domain, :host, :port, :protocol, :subdomain)) : url_for
    redirect_to 
  end
end

#user_for_paper_trailObject

Papertrail Whodunnit Username



11
12
13
14
# File 'app/controllers/phcscriptcdnpro/application_controller.rb', line 11

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