Class: SimpleAuth::ActionController::RequireLoginAction
- Inherits:
-
Object
- Object
- SimpleAuth::ActionController::RequireLoginAction
- Defined in:
- lib/simple_auth/action_controller/require_login_action.rb
Constant Summary collapse
- DEFAULT_UNLOGGED_IN_MESSAGE =
"You must be logged in to access this page."- DEFAULT_UNAUTHORIZED_MESSAGE =
"You don't have permission to access this page."
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(controller, scope) ⇒ RequireLoginAction
constructor
A new instance of RequireLoginAction.
- #message ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(controller, scope) ⇒ RequireLoginAction
Returns a new instance of RequireLoginAction.
12 13 14 15 |
# File 'lib/simple_auth/action_controller/require_login_action.rb', line 12 def initialize(controller, scope) @controller = controller @scope = scope end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
10 11 12 |
# File 'lib/simple_auth/action_controller/require_login_action.rb', line 10 def controller @controller end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
10 11 12 |
# File 'lib/simple_auth/action_controller/require_login_action.rb', line 10 def scope @scope end |
Instance Method Details
#message ⇒ Object
21 22 23 24 25 26 |
# File 'lib/simple_auth/action_controller/require_login_action.rb', line 21 def return if valid? return unless end |
#valid? ⇒ Boolean
17 18 19 |
# File 'lib/simple_auth/action_controller/require_login_action.rb', line 17 def valid? valid_session? && end |