Class: Phcscriptcdnpro::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Phcscriptcdnpro::ApplicationController
- Defined in:
- app/controllers/phcscriptcdnpro/application_controller.rb
Direct Known Subclasses
Frontend::ListingsController, Script::AuthorsController, Script::ExtensionsController, Script::LicencesController, Script::ListingsController, Script::UrlsController, Script::VersionsController
Instance Method Summary collapse
- #current_user ⇒ Object
-
#get_member_profile_info ⇒ Object
Grab Member Information.
- #membership_info ⇒ Object
- #new_login_url ⇒ Object
-
#require_user ⇒ Object
Authentication.
-
#user_for_paper_trail ⇒ Object
Papertrail Whodunnit Username.
Instance Method Details
#current_user ⇒ Object
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_info ⇒ Object
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_info ⇒ Object
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_url ⇒ Object
38 39 40 41 |
# File 'app/controllers/phcscriptcdnpro/application_controller.rb', line 38 def new_login_url ENV['AUTHROCKET_LOGIN_URL'] # $ar_login_url end |
#require_user ⇒ Object
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 new_login_url end end |
#user_for_paper_trail ⇒ Object
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 |