Module: SudoRails
- Extended by:
- Styling
- Defined in:
- lib/sudo_rails.rb,
lib/sudo_rails/engine.rb,
lib/sudo_rails/styling.rb,
lib/sudo_rails/version.rb,
lib/sudo_rails/controller_ext.rb,
app/controllers/sudo_rails/application_controller.rb
Defined Under Namespace
Modules: ControllerExt, Styling Classes: ApplicationController, ConfigGenerator, Engine, ViewGenerator
Constant Summary collapse
- VERSION =
"0.8.0"
Class Attribute Summary collapse
-
.background_color ⇒ Object
Returns the value of attribute background_color.
-
.confirm_strategy ⇒ Object
Returns the value of attribute confirm_strategy.
-
.custom_logo ⇒ Object
Returns the value of attribute custom_logo.
-
.enabled ⇒ Object
Returns the value of attribute enabled.
-
.layout ⇒ Object
Returns the value of attribute layout.
-
.primary_color ⇒ Object
Returns the value of attribute primary_color.
-
.reset_pass_link ⇒ Object
Returns the value of attribute reset_pass_link.
-
.sudo_session_duration ⇒ Object
Returns the value of attribute sudo_session_duration.
Class Method Summary collapse
- .confirm?(context, password) ⇒ Boolean
- .setup {|_self| ... } ⇒ Object
- .valid_sudo_session?(started_at) ⇒ Boolean
Methods included from Styling
Class Attribute Details
.background_color ⇒ Object
Returns the value of attribute background_color.
10 11 12 |
# File 'lib/sudo_rails.rb', line 10 def background_color @background_color end |
.confirm_strategy ⇒ Object
Returns the value of attribute confirm_strategy.
10 11 12 |
# File 'lib/sudo_rails.rb', line 10 def confirm_strategy @confirm_strategy end |
.custom_logo ⇒ Object
Returns the value of attribute custom_logo.
10 11 12 |
# File 'lib/sudo_rails.rb', line 10 def custom_logo @custom_logo end |
.enabled ⇒ Object
Returns the value of attribute enabled.
10 11 12 |
# File 'lib/sudo_rails.rb', line 10 def enabled @enabled end |
.layout ⇒ Object
Returns the value of attribute layout.
10 11 12 |
# File 'lib/sudo_rails.rb', line 10 def layout @layout end |
.primary_color ⇒ Object
Returns the value of attribute primary_color.
10 11 12 |
# File 'lib/sudo_rails.rb', line 10 def primary_color @primary_color end |
.reset_pass_link ⇒ Object
Returns the value of attribute reset_pass_link.
10 11 12 |
# File 'lib/sudo_rails.rb', line 10 def reset_pass_link @reset_pass_link end |
.sudo_session_duration ⇒ Object
Returns the value of attribute sudo_session_duration.
10 11 12 |
# File 'lib/sudo_rails.rb', line 10 def sudo_session_duration @sudo_session_duration end |
Class Method Details
.confirm?(context, password) ⇒ Boolean
23 24 25 26 27 28 |
# File 'lib/sudo_rails.rb', line 23 def confirm?(context, password) strategy = confirm_strategy raise(ArgumentError, 'Please, provide an strategy via SudoRails.confirm_strategy') unless strategy strategy.call(context, password) end |
.setup {|_self| ... } ⇒ Object
19 20 21 |
# File 'lib/sudo_rails.rb', line 19 def setup yield(self) if block_given? end |
.valid_sudo_session?(started_at) ⇒ Boolean
30 31 32 33 34 35 |
# File 'lib/sudo_rails.rb', line 30 def valid_sudo_session?(started_at) return false unless started_at return true if sudo_session_duration.nil? DateTime.parse(started_at) + sudo_session_duration > Time.zone.now end |