Module: Hello::RailsController

Extended by:
ActiveSupport::Concern
Defined in:
lib/hello/rails_controller.rb,
lib/hello/rails_controller/restrict_by_role.rb

Defined Under Namespace

Modules: ClassMethods Classes: RestrictByRole

Instance Method Summary collapse

Instance Method Details

#hello_managerObject



48
49
50
# File 'lib/hello/rails_controller.rb', line 48

def hello_manager
  request.env['hello'] ||= Hello::RequestManager.create(request)
end

#hello_store_url_on_session!Object



58
59
60
61
62
# File 'lib/hello/rails_controller.rb', line 58

def hello_store_url_on_session!
  if hello_manager.stateful?
    session[:url] = url_for(params.permit!.merge(only_path: true))
  end
end

#render_sudo_mode_formObject



77
78
79
# File 'lib/hello/rails_controller.rb', line 77

def render_sudo_mode_form
  render 'hello/authentication/sudo_mode'
end

#sign_up_disabledObject



54
55
56
# File 'lib/hello/rails_controller.rb', line 54

def 
  Hello.configuration. || action_name=='disabled'
end

#sudo_modeObject



70
71
72
73
74
75
# File 'lib/hello/rails_controller.rb', line 70

def sudo_mode
  unless sudo_mode?
    hello_store_url_on_session!
    render_sudo_mode_form
  end
end

#sudo_mode?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/hello/rails_controller.rb', line 66

def sudo_mode?
  current_access && current_access.sudo_expires_at.future?
end