Skip to content

Commit afc10f8

Browse files
committed
Fixes #12966 - get rid if values_at in console authorizer
1 parent 08256a2 commit afc10f8

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

lib/foreman_tasks/dynflow/console_authorizer.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
module ForemanTasks
33
class Dynflow::ConsoleAuthorizer
44
def initialize(env)
5-
@rack_request = Rack::Request.new(env)
6-
@user_id, @expires_at = @rack_request.session.values_at('user', 'expires_at')
7-
@user = User.where(:id => @user_id).first unless session_expired?
5+
@rack_request = Rack::Request.new(env)
6+
@user_id = @rack_request.session[:user]
7+
@expires_at = @rack_request.session[:expires_at]
8+
@user = User.where(:id => @user_id).first unless session_expired?
89
end
910

1011
def allow?

test/unit/dynflow_console_authorizer_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def dynflow_console_authorized?(task = nil)
2323
dynflow_path = '/'
2424
dynflow_path += task.external_id.to_s if task
2525
dynflow_rack_env = { "rack.session" => { "user" => user.id, "expires_at" => Time.now + 100 },
26-
"PATH_INFO" => dynflow_path}
26+
"PATH_INFO" => dynflow_path}.with_indifferent_access
2727
ForemanTasks::Dynflow::ConsoleAuthorizer.new(dynflow_rack_env).allow?
2828
end
2929

0 commit comments

Comments
 (0)