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
- #authrocket_membership_info ⇒ Object
- #current_user ⇒ Object
- #new_login_url ⇒ Object
-
#require_user ⇒ Object
AuthRocket Definitions.
-
#user_for_paper_trail ⇒ Object
Papertrail Whodunnit Username.
Instance Method Details
#authrocket_membership_info ⇒ Object
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_user ⇒ Object
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_url ⇒ Object
29 30 31 |
# File 'app/controllers/phcscriptcdnpro/application_controller.rb', line 29 def new_login_url ENV['AUTHROCKET_LOGIN_URL'] end |
#require_user ⇒ Object
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 new_login_url end end |
#user_for_paper_trail ⇒ Object
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 |