Class: ForemanTasks::Dynflow::ConsoleAuthorizer
- Inherits:
-
Object
- Object
- ForemanTasks::Dynflow::ConsoleAuthorizer
- Defined in:
- lib/foreman_tasks/dynflow/console_authorizer.rb
Class Method Summary collapse
Instance Method Summary collapse
- #allow? ⇒ Boolean
-
#initialize(request) ⇒ ConsoleAuthorizer
constructor
A new instance of ConsoleAuthorizer.
Constructor Details
#initialize(request) ⇒ ConsoleAuthorizer
Returns a new instance of ConsoleAuthorizer.
14 15 16 17 18 19 |
# File 'lib/foreman_tasks/dynflow/console_authorizer.rb', line 14 def initialize(request) @rack_request = request @user_id = @rack_request.session[:user] @expires_at = @rack_request.session[:expires_at] @user = User.unscoped.where(:id => @user_id).first unless session_expired? end |
Class Method Details
.from_env(env) ⇒ Object
10 11 12 |
# File 'lib/foreman_tasks/dynflow/console_authorizer.rb', line 10 def self.from_env(env) new(Rack::Request.new(env)) end |
Instance Method Details
#allow? ⇒ Boolean
21 22 23 |
# File 'lib/foreman_tasks/dynflow/console_authorizer.rb', line 21 def allow? @user && (unlimited_edit? || ) end |