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.
9 10 11 12 |
# File 'lib/simple_auth/action_controller/require_login_action.rb', line 9 def initialize(controller, scope) @controller = controller @scope = scope end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
7 8 9 |
# File 'lib/simple_auth/action_controller/require_login_action.rb', line 7 def controller @controller end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
7 8 9 |
# File 'lib/simple_auth/action_controller/require_login_action.rb', line 7 def scope @scope end |
Instance Method Details
#message ⇒ Object
18 19 20 21 22 |
# File 'lib/simple_auth/action_controller/require_login_action.rb', line 18 def return nil if valid? return unless end |
#valid? ⇒ Boolean
14 15 16 |
# File 'lib/simple_auth/action_controller/require_login_action.rb', line 14 def valid? valid_session? && end |