From 82041f427b8c53d7800dbac2561729e38c6327ab Mon Sep 17 00:00:00 2001 From: Dominik Klein Date: Wed, 5 Jan 2022 12:50:34 +0100 Subject: [PATCH] Fixes #3905 - Usage of freshdesk import without freshdesk admin permission leads to an unstable system/missing data --- .../import_freshdesk_controller.rb | 17 +- .../import/freshdesk/permission_check.rb | 22 +++ .../unit/freshdesk/permission_present.rb | 24 +++ .../unit/freshdesk/permission_present_spec.rb | 31 ++++ ..._fields_validation_invalid_credentials.yml | 36 ++-- ...esk_fields_validation_invalid_hostname.yml | 10 +- ...k_fields_validation_shows_start_button.yml | 102 +++++++++-- ...sk_fields_validation_valid_credentials.yml | 160 +++++++++--------- ...hdesk_fields_validation_valid_hostname.yml | 10 +- .../freshdesk/import_progress_setup.yml | 102 +++++++++-- 10 files changed, 376 insertions(+), 138 deletions(-) create mode 100644 lib/sequencer/sequence/import/freshdesk/permission_check.rb create mode 100644 lib/sequencer/unit/freshdesk/permission_present.rb create mode 100644 spec/lib/sequencer/unit/freshdesk/permission_present_spec.rb diff --git a/app/controllers/import_freshdesk_controller.rb b/app/controllers/import_freshdesk_controller.rb index 96b0ae0aa..fe2b3eb77 100644 --- a/app/controllers/import_freshdesk_controller.rb +++ b/app/controllers/import_freshdesk_controller.rb @@ -50,9 +50,9 @@ class ImportFreshdeskController < ApplicationController Setting.set('import_freshdesk_endpoint_key', params[:token]) - result = Sequencer.process('Import::Freshdesk::ConnectionTest') + connection_result = Sequencer.process('Import::Freshdesk::ConnectionTest') - if !result[:connected] + if !connection_result[:connected] Setting.set('import_freshdesk_endpoint_key', nil) @@ -63,6 +63,19 @@ class ImportFreshdeskController < ApplicationController return end + permission_result = Sequencer.process('Import::Freshdesk::PermissionCheck') + + if !permission_result[:permission_present] + + Setting.set('import_freshdesk_endpoint_key', nil) + + render json: { + result: 'invalid', + message_human: 'Missing administrator permission!', + } + return + end + render json: { result: 'ok', } diff --git a/lib/sequencer/sequence/import/freshdesk/permission_check.rb b/lib/sequencer/sequence/import/freshdesk/permission_check.rb new file mode 100644 index 000000000..a9ea90520 --- /dev/null +++ b/lib/sequencer/sequence/import/freshdesk/permission_check.rb @@ -0,0 +1,22 @@ +# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ + +class Sequencer + class Sequence + module Import + module Freshdesk + class PermissionCheck < Sequencer::Sequence::Base + + def self.expecting + [:permission_present] + end + + def self.sequence + [ + 'Freshdesk::PermissionPresent', + ] + end + end + end + end + end +end diff --git a/lib/sequencer/unit/freshdesk/permission_present.rb b/lib/sequencer/unit/freshdesk/permission_present.rb new file mode 100644 index 000000000..bbc96b315 --- /dev/null +++ b/lib/sequencer/unit/freshdesk/permission_present.rb @@ -0,0 +1,24 @@ +# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ + +class Sequencer + class Unit + module Freshdesk + class PermissionPresent < Sequencer::Unit::Common::Provider::Named + extend ::Sequencer::Unit::Import::Freshdesk::Requester + + private + + def permission_present + response = self.class.perform_request( + api_path: 'agents', + ) + + response.is_a?(Net::HTTPOK) + rescue => e + logger.error e + nil + end + end + end + end +end diff --git a/spec/lib/sequencer/unit/freshdesk/permission_present_spec.rb b/spec/lib/sequencer/unit/freshdesk/permission_present_spec.rb new file mode 100644 index 000000000..1bd46e88e --- /dev/null +++ b/spec/lib/sequencer/unit/freshdesk/permission_present_spec.rb @@ -0,0 +1,31 @@ +# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ + +require 'rails_helper' + +RSpec.describe Sequencer::Unit::Freshdesk::PermissionPresent, sequencer: :unit do + + context 'when checking the permission to Freshdesk' do + + let(:params) do + { + dry_run: false, + import_job: instance_double(ImportJob), + field_map: {}, + id_map: {}, + } + end + + let(:response_ok) { Net::HTTPOK.new(1.0, '200', 'OK') } + let(:response_forbidden) { Net::HTTPForbidden.new(1.0, '403', 'Forbidden') } + + it 'check for correct permission' do + allow(described_class).to receive(:perform_request).with(any_args).and_return(response_ok) + expect(process(params)).to eq({ permission_present: true }) + end + + it 'check for forbidden permission' do + allow(described_class).to receive(:perform_request).with(any_args).and_return(response_forbidden) + expect(process(params)).to eq({ permission_present: false }) + end + end +end diff --git a/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_invalid_credentials.yml b/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_invalid_credentials.yml index 1a4ba786e..9576628a0 100644 --- a/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_invalid_credentials.yml +++ b/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_invalid_credentials.yml @@ -21,7 +21,7 @@ http_interactions: message: Unauthorized headers: Date: - - Thu, 08 Jul 2021 14:44:52 GMT + - Tue, 04 Jan 2022 12:44:06 GMT Content-Type: - application/json; charset=utf-8 Transfer-Encoding: @@ -31,7 +31,7 @@ http_interactions: Status: - 401 Unauthorized X-Request-Id: - - 0ce1a277-88bd-4d52-9202-e7c40b92cb38 + - 6aa908c1-0f2e-43b8-a240-6b0e6389865e X-Freshdesk-Api-Version: - latest=v2; requested=v2 X-Rack-Cache: @@ -51,20 +51,20 @@ http_interactions: X-Ratelimit-Total: - '40' X-Ratelimit-Remaining: - - '39' + - '38' X-Ratelimit-Used-Currentrequest: - '1' X-Envoy-Upstream-Service-Time: - - '31' + - '38' X-Trace-Id: - - 00-51ed9c1c0a83b39abc54bc0c33cc642b-dc8bddd14d14bc03-00 + - 00-c86e324be3fbb8d36ea12b763341ab25-1af8213b43da7a01-00 Server: - fwe body: encoding: UTF-8 string: '{"code":"invalid_credentials","message":"You have to be logged in to perform this action."}' - recorded_at: Thu, 08 Jul 2021 14:44:52 GMT + recorded_at: Tue, 04 Jan 2022 12:44:06 GMT - request: method: get uri: https://.freshdesk.com/api/v2/agents/me @@ -90,7 +90,7 @@ http_interactions: message: Unauthorized headers: Date: - - Thu, 08 Jul 2021 14:44:53 GMT + - Tue, 04 Jan 2022 12:44:08 GMT Content-Type: - application/json; charset=utf-8 Transfer-Encoding: @@ -100,7 +100,7 @@ http_interactions: Status: - 401 Unauthorized X-Request-Id: - - 5719108c-486f-40f0-9fdf-7caba98042f7 + - 623010a9-972b-4f0f-96dd-274ca3ca1824 X-Freshdesk-Api-Version: - latest=v2; requested=v2 X-Rack-Cache: @@ -120,20 +120,20 @@ http_interactions: X-Ratelimit-Total: - '100' X-Ratelimit-Remaining: - - '98' + - '95' X-Ratelimit-Used-Currentrequest: - '1' X-Envoy-Upstream-Service-Time: - - '39' + - '38' X-Trace-Id: - - 00-5c35e85dfee04cac7f75d7ab33d64969-f8f94253325a913e-00 + - 00-1cbd052b2b9c630d1bb6a6fa4c9a5a4b-46afe1e1c9f07eb4-00 Server: - fwe body: encoding: UTF-8 string: '{"code":"invalid_credentials","message":"You have to be logged in to perform this action."}' - recorded_at: Thu, 08 Jul 2021 14:44:53 GMT + recorded_at: Tue, 04 Jan 2022 12:44:08 GMT - request: method: get uri: https://.freshdesk.com/api/v2/agents/me @@ -159,7 +159,7 @@ http_interactions: message: Unauthorized headers: Date: - - Thu, 08 Jul 2021 14:44:53 GMT + - Tue, 04 Jan 2022 12:44:08 GMT Content-Type: - application/json; charset=utf-8 Transfer-Encoding: @@ -169,7 +169,7 @@ http_interactions: Status: - 401 Unauthorized X-Request-Id: - - ca94e08c-04a5-44ad-837e-7dd0cb693fd9 + - 8db4db19-a022-9a66-bb34-f53f9fdefadd X-Freshdesk-Api-Version: - latest=v2; requested=v2 X-Rack-Cache: @@ -189,18 +189,18 @@ http_interactions: X-Ratelimit-Total: - '100' X-Ratelimit-Remaining: - - '97' + - '94' X-Ratelimit-Used-Currentrequest: - '1' X-Envoy-Upstream-Service-Time: - - '75' + - '41' X-Trace-Id: - - 00-3ed5efb5331d9b0e6cfd35a96da0e7ca-7a1106d2c14516ba-00 + - 00-ebf6f2a91d6b0a6fad1f8c2cafd57b91-dedbf40ba0772163-01 Server: - fwe body: encoding: UTF-8 string: '{"code":"invalid_credentials","message":"You have to be logged in to perform this action."}' - recorded_at: Thu, 08 Jul 2021 14:44:53 GMT + recorded_at: Tue, 04 Jan 2022 12:44:08 GMT recorded_with: VCR 6.0.0 diff --git a/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_invalid_hostname.yml b/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_invalid_hostname.yml index 02472e4be..9065c9daa 100644 --- a/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_invalid_hostname.yml +++ b/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_invalid_hostname.yml @@ -21,7 +21,7 @@ http_interactions: message: Not Found headers: Date: - - Thu, 08 Jul 2021 14:44:47 GMT + - Tue, 04 Jan 2022 12:44:01 GMT Content-Type: - application/json; charset=utf-8 Transfer-Encoding: @@ -31,7 +31,7 @@ http_interactions: Status: - 404 Not Found X-Request-Id: - - edf9bb99-1c3c-48df-875e-455cbd963c52 + - b4148d62-dba8-4793-863d-1b105508d70f X-Rack-Cache: - miss Cache-Control: @@ -45,13 +45,13 @@ http_interactions: X-Fw-Ratelimiting-Managed: - 'false' X-Envoy-Upstream-Service-Time: - - '29' + - '35' X-Trace-Id: - - 00-e50f39ffa8d89a7ab2f260463b10436e-4d93e6d797831b87-00 + - 00-5dc27c3d059e008ef1749ca95a2ccf82-c7226e440cca5cf6-00 Server: - fwe body: encoding: ASCII-8BIT string: " " - recorded_at: Thu, 08 Jul 2021 14:44:47 GMT + recorded_at: Tue, 04 Jan 2022 12:44:01 GMT recorded_with: VCR 6.0.0 diff --git a/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_shows_start_button.yml b/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_shows_start_button.yml index 63b688025..6cd55c190 100644 --- a/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_shows_start_button.yml +++ b/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_shows_start_button.yml @@ -21,7 +21,7 @@ http_interactions: message: Unauthorized headers: Date: - - Thu, 08 Jul 2021 14:44:59 GMT + - Tue, 04 Jan 2022 12:43:13 GMT Content-Type: - application/json; charset=utf-8 Transfer-Encoding: @@ -31,7 +31,7 @@ http_interactions: Status: - 401 Unauthorized X-Request-Id: - - 23514661-1b1e-4794-af85-4258cd13df06 + - 5745f576-faca-4cf5-84dc-66da88902de7 X-Freshdesk-Api-Version: - latest=v2; requested=v2 X-Rack-Cache: @@ -51,20 +51,20 @@ http_interactions: X-Ratelimit-Total: - '40' X-Ratelimit-Remaining: - - '37' + - '39' X-Ratelimit-Used-Currentrequest: - '1' X-Envoy-Upstream-Service-Time: - - '36' + - '48' X-Trace-Id: - - 00-1369aa8348250d3161f7be598ec434f4-2966dbe53b8eae9f-00 + - 00-42b68f35b1e7b55b914e542cd24f1194-25d22a931984720d-00 Server: - fwe body: encoding: UTF-8 string: '{"code":"invalid_credentials","message":"You have to be logged in to perform this action."}' - recorded_at: Thu, 08 Jul 2021 14:44:59 GMT + recorded_at: Tue, 04 Jan 2022 12:43:13 GMT - request: method: get uri: https://.freshdesk.com/api/v2/agents/me @@ -90,7 +90,7 @@ http_interactions: message: OK headers: Date: - - Thu, 08 Jul 2021 14:45:01 GMT + - Tue, 04 Jan 2022 12:43:15 GMT Content-Type: - application/json; charset=utf-8 Transfer-Encoding: @@ -102,7 +102,7 @@ http_interactions: Pragma: - no-cache X-Request-Id: - - d5ab60cd-84d3-4816-8a52-01410cb3c82f + - 993f3356-2352-4fb3-9788-25732c019fe9 X-Freshdesk-Api-Version: - latest=v2; requested=v2 X-Rack-Cache: @@ -118,7 +118,7 @@ http_interactions: Expires: - Wed, 13 Oct 2010 00:00:00 UTC Set-Cookie: - - _helpkit_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJTQ0MjMyNGNkZWQ3YjhjZDE5ZTU2YWI5ZWFiZmYwYWRmBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMVFnWXQveElsdWNnY2RaR3NiOXAwRWVjbU1EZk9ISWFPYlJpYXNCaEgyQUk9BjsARg%3D%3D--7c926b47ede8867f6c888c5df8a516fea8b1be9a; + - _helpkit_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJTUyNmE2MTg5OGRhNjY4NzUwMGU5Mjg1MzY4YzQyMzJkBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMU9RWkc5bjlBQlh3cmc2V1MvSll6bnRvREFncDVuaWxGdTVzVnBDaUlvdXc9BjsARg%3D%3D--af05d1409834c6632dd49fc0b6f3a5a704655a1f; path=/; HttpOnly; secure - _x_w=5_2; path=/; HttpOnly; secure X-Fw-Ratelimiting-Managed: @@ -126,18 +126,92 @@ http_interactions: X-Ratelimit-Total: - '100' X-Ratelimit-Remaining: - - '92' + - '98' X-Ratelimit-Used-Currentrequest: - '1' X-Envoy-Upstream-Service-Time: - - '51' + - '78' X-Trace-Id: - - 00-1907904008abae8ffb674d4d6e17d131-f421d789c393542e-00 + - 00-76b5ddcacdcb6167517e3ce8ab8730f1-e607ea520c3e4b2f-00 Server: - fwe body: encoding: ASCII-8BIT string: '{"available":false,"occasional":false,"id":80014400475,"ticket_scope":1,"signature":null,"group_ids":[],"role_ids":[80000198826],"skill_ids":[],"available_since":null,"contact":{"active":true,"email":"info@.org","job_title":null,"language":"en","mobile":null,"name":"Thorsten - Eckel","phone":null,"time_zone":"Eastern Time (US & Canada)","created_at":"2021-04-09T13:23:58Z","updated_at":"2021-04-09T13:31:00Z","last_login_at":"2021-06-07T05:38:22Z"},"created_at":"2021-04-09T13:23:58Z","updated_at":"2021-07-08T07:08:47Z","type":"support_agent"}' - recorded_at: Thu, 08 Jul 2021 14:45:01 GMT + Eckel","phone":null,"time_zone":"Eastern Time (US & Canada)","created_at":"2021-04-09T13:23:58Z","updated_at":"2021-04-09T13:31:00Z","last_login_at":"2021-10-07T17:33:11Z"},"created_at":"2021-04-09T13:23:58Z","updated_at":"2022-01-03T18:35:31Z","type":"support_agent"}' + recorded_at: Tue, 04 Jan 2022 12:43:15 GMT +- request: + method: get + uri: https://.freshdesk.com/api/v2/agents + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - ".freshdesk.com" + Authorization: + - Basic + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 04 Jan 2022 12:43:15 GMT + Content-Type: + - application/json; charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Status: + - 200 OK + Pragma: + - no-cache + X-Request-Id: + - 5826ff4b-05d3-91c4-b4ab-1d6bf8508335 + X-Freshdesk-Api-Version: + - latest=v2; requested=v2 + X-Rack-Cache: + - miss + Cache-Control: + - must-revalidate, no-cache, no-store, private, max-age=0 + X-Xss-Protection: + - 1; mode=block + X-Ua-Compatible: + - IE=Edge,chrome=1 + X-Content-Type-Options: + - nosniff + Expires: + - Wed, 13 Oct 2010 00:00:00 UTC + Set-Cookie: + - _x_w=5_2; path=/; HttpOnly; secure + X-Fw-Ratelimiting-Managed: + - 'true' + X-Ratelimit-Total: + - '100' + X-Ratelimit-Remaining: + - '97' + X-Ratelimit-Used-Currentrequest: + - '1' + X-Envoy-Upstream-Service-Time: + - '63' + X-Trace-Id: + - 00-b8ca4c0600032eb7fcb920b2abd0013d-ab8383a7478ac77f-01 + Server: + - fwe + body: + encoding: ASCII-8BIT + string: '[{"available":false,"occasional":true,"id":80014400480,"ticket_scope":1,"created_at":"2021-04-09T13:24:01Z","updated_at":"2021-04-09T13:24:01Z","last_active_at":null,"available_since":null,"type":"support_agent","contact":{"active":false,"email":"custserv@freshdesk.com","job_title":null,"language":"en","last_login_at":null,"mobile":null,"name":"Customer + Service","phone":null,"time_zone":"Eastern Time (US & Canada)","created_at":"2021-04-09T13:24:01Z","updated_at":"2021-04-09T13:24:01Z"},"signature":null},{"available":false,"occasional":false,"id":80014400475,"ticket_scope":1,"created_at":"2021-04-09T13:23:58Z","updated_at":"2022-01-03T18:35:31Z","last_active_at":"2022-01-03T18:35:31Z","available_since":null,"type":"support_agent","contact":{"active":true,"email":"info@.org","job_title":null,"language":"en","last_login_at":"2021-10-07T17:33:11Z","mobile":null,"name":"Thorsten + Eckel","phone":null,"time_zone":"Eastern Time (US & Canada)","created_at":"2021-04-09T13:23:58Z","updated_at":"2021-04-09T13:31:00Z"},"signature":null}]' + recorded_at: Tue, 04 Jan 2022 12:43:15 GMT recorded_with: VCR 6.0.0 diff --git a/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_valid_credentials.yml b/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_valid_credentials.yml index 96a8d3cee..a17683764 100644 --- a/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_valid_credentials.yml +++ b/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_valid_credentials.yml @@ -21,7 +21,7 @@ http_interactions: message: Unauthorized headers: Date: - - Thu, 08 Jul 2021 14:44:55 GMT + - Tue, 04 Jan 2022 12:44:10 GMT Content-Type: - application/json; charset=utf-8 Transfer-Encoding: @@ -31,7 +31,7 @@ http_interactions: Status: - 401 Unauthorized X-Request-Id: - - 7902d2cc-0bee-4f7c-9422-0a803602306b + - df91e7c3-2063-4793-a226-6059dd715c90 X-Freshdesk-Api-Version: - latest=v2; requested=v2 X-Rack-Cache: @@ -51,20 +51,20 @@ http_interactions: X-Ratelimit-Total: - '40' X-Ratelimit-Remaining: - - '38' + - '37' X-Ratelimit-Used-Currentrequest: - '1' X-Envoy-Upstream-Service-Time: - - '44' + - '47' X-Trace-Id: - - 00-bf646768b4fb3bbf4733ab1d89f9cc65-d5c0ee890610da12-00 + - 00-efa020d9face7343512e02716bda4cb9-c249a978507c79a2-00 Server: - fwe body: encoding: UTF-8 string: '{"code":"invalid_credentials","message":"You have to be logged in to perform this action."}' - recorded_at: Thu, 08 Jul 2021 14:44:55 GMT + recorded_at: Tue, 04 Jan 2022 12:44:10 GMT - request: method: get uri: https://.freshdesk.com/api/v2/agents/me @@ -90,7 +90,7 @@ http_interactions: message: Unauthorized headers: Date: - - Thu, 08 Jul 2021 14:44:57 GMT + - Tue, 04 Jan 2022 12:44:11 GMT Content-Type: - application/json; charset=utf-8 Transfer-Encoding: @@ -100,7 +100,7 @@ http_interactions: Status: - 401 Unauthorized X-Request-Id: - - 8007c6d5-96f0-9608-9571-59cad9b5d205 + - a0b5cf13-ca57-4d83-83e1-0549d05bb89e X-Freshdesk-Api-Version: - latest=v2; requested=v2 X-Rack-Cache: @@ -120,87 +120,87 @@ http_interactions: X-Ratelimit-Total: - '100' X-Ratelimit-Remaining: - - '95' + - '92' + X-Ratelimit-Used-Currentrequest: + - '1' + X-Envoy-Upstream-Service-Time: + - '40' + X-Trace-Id: + - 00-5093a663f6de7078b6f259501bcbad5c-16038b8e950af115-00 + Server: + - fwe + body: + encoding: UTF-8 + string: '{"code":"invalid_credentials","message":"You have to be logged in to + perform this action."}' + recorded_at: Tue, 04 Jan 2022 12:44:11 GMT +- request: + method: get + uri: https://.freshdesk.com/api/v2/agents/me + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - ".freshdesk.com" + Authorization: + - Basic MW52NGwxZFQwSzNOOlg= + response: + status: + code: 401 + message: Unauthorized + headers: + Date: + - Tue, 04 Jan 2022 12:44:12 GMT + Content-Type: + - application/json; charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Status: + - 401 Unauthorized + X-Request-Id: + - 9d6cf8b0-d3f9-4156-aeb3-09083bf2a737 + X-Freshdesk-Api-Version: + - latest=v2; requested=v2 + X-Rack-Cache: + - miss + Cache-Control: + - no-cache, private + X-Xss-Protection: + - 1; mode=block + X-Ua-Compatible: + - IE=Edge,chrome=1 + X-Content-Type-Options: + - nosniff + Set-Cookie: + - _x_w=5_2; path=/; HttpOnly; secure + X-Fw-Ratelimiting-Managed: + - 'true' + X-Ratelimit-Total: + - '100' + X-Ratelimit-Remaining: + - '91' X-Ratelimit-Used-Currentrequest: - '1' X-Envoy-Upstream-Service-Time: - '36' X-Trace-Id: - - 00-3740e89fc64ccd0a3b92ed13203aeaf7-e34c3c1b71452bba-01 + - 00-ec39a5c61d07b7fdbd8100bd353311fd-66ac1c542a6efa68-00 Server: - fwe body: encoding: UTF-8 string: '{"code":"invalid_credentials","message":"You have to be logged in to perform this action."}' - recorded_at: Thu, 08 Jul 2021 14:44:57 GMT -- request: - method: get - uri: https://.freshdesk.com/api/v2/agents/me - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - Ruby - Host: - - ".freshdesk.com" - Authorization: - - Basic MW52NGwxZFQwSzNOOlg= - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Thu, 08 Jul 2021 14:44:57 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Status: - - 401 Unauthorized - X-Request-Id: - - 0b8d8dee-e471-40db-ae98-962331e21405 - X-Freshdesk-Api-Version: - - latest=v2; requested=v2 - X-Rack-Cache: - - miss - Cache-Control: - - no-cache, private - X-Xss-Protection: - - 1; mode=block - X-Ua-Compatible: - - IE=Edge,chrome=1 - X-Content-Type-Options: - - nosniff - Set-Cookie: - - _x_w=5_2; path=/; HttpOnly; secure - X-Fw-Ratelimiting-Managed: - - 'true' - X-Ratelimit-Total: - - '100' - X-Ratelimit-Remaining: - - '94' - X-Ratelimit-Used-Currentrequest: - - '1' - X-Envoy-Upstream-Service-Time: - - '78' - X-Trace-Id: - - 00-02cfc4ead37ab53768d74f2055525b82-acaa880886cf4572-00 - Server: - - fwe - body: - encoding: UTF-8 - string: '{"code":"invalid_credentials","message":"You have to be logged in to - perform this action."}' - recorded_at: Thu, 08 Jul 2021 14:44:57 GMT + recorded_at: Tue, 04 Jan 2022 12:44:11 GMT recorded_with: VCR 6.0.0 diff --git a/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_valid_hostname.yml b/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_valid_hostname.yml index f6b9f81e4..4ec598ecd 100644 --- a/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_valid_hostname.yml +++ b/test/data/vcr_cassettes/system/import/freshdesk/import_freshdesk_fields_validation_valid_hostname.yml @@ -21,7 +21,7 @@ http_interactions: message: Not Found headers: Date: - - Thu, 08 Jul 2021 14:44:49 GMT + - Tue, 04 Jan 2022 12:44:04 GMT Content-Type: - application/json; charset=utf-8 Transfer-Encoding: @@ -31,7 +31,7 @@ http_interactions: Status: - 404 Not Found X-Request-Id: - - 0331764a-f490-4d1c-a2ca-474b7c7d3b25 + - ad01f052-b3de-4a2b-bd6b-174d9b696f57 X-Rack-Cache: - miss Cache-Control: @@ -45,13 +45,13 @@ http_interactions: X-Fw-Ratelimiting-Managed: - 'false' X-Envoy-Upstream-Service-Time: - - '31' + - '32' X-Trace-Id: - - 00-03bc675e6fd9c1676c45ca67aef06828-1fe725684acee4f8-00 + - 00-09c3d5f076833268b0f24307042fd611-435154e41b725092-00 Server: - fwe body: encoding: ASCII-8BIT string: " " - recorded_at: Thu, 08 Jul 2021 14:44:50 GMT + recorded_at: Tue, 04 Jan 2022 12:44:04 GMT recorded_with: VCR 6.0.0 diff --git a/test/data/vcr_cassettes/system/import/freshdesk/import_progress_setup.yml b/test/data/vcr_cassettes/system/import/freshdesk/import_progress_setup.yml index 8b3643b97..31bd6c861 100644 --- a/test/data/vcr_cassettes/system/import/freshdesk/import_progress_setup.yml +++ b/test/data/vcr_cassettes/system/import/freshdesk/import_progress_setup.yml @@ -21,7 +21,7 @@ http_interactions: message: Unauthorized headers: Date: - - Thu, 08 Jul 2021 14:45:03 GMT + - Tue, 04 Jan 2022 12:44:17 GMT Content-Type: - application/json; charset=utf-8 Transfer-Encoding: @@ -31,7 +31,7 @@ http_interactions: Status: - 401 Unauthorized X-Request-Id: - - 16535d28-0fa9-4bbd-81a5-7734a134dbe6 + - cd0481fb-175a-4720-a94b-eefe4f1bb918 X-Freshdesk-Api-Version: - latest=v2; requested=v2 X-Rack-Cache: @@ -51,20 +51,20 @@ http_interactions: X-Ratelimit-Total: - '40' X-Ratelimit-Remaining: - - '36' + - '39' X-Ratelimit-Used-Currentrequest: - '1' X-Envoy-Upstream-Service-Time: - - '226' + - '38' X-Trace-Id: - - 00-cfd704f35e647fd26907025f0d0227db-0078eeaf66759491-00 + - 00-149154c0cbc8583fee25c248dbcd2f43-be1120345e719f2d-00 Server: - fwe body: encoding: UTF-8 string: '{"code":"invalid_credentials","message":"You have to be logged in to perform this action."}' - recorded_at: Thu, 08 Jul 2021 14:45:03 GMT + recorded_at: Tue, 04 Jan 2022 12:44:17 GMT - request: method: get uri: https://.freshdesk.com/api/v2/agents/me @@ -90,7 +90,7 @@ http_interactions: message: OK headers: Date: - - Thu, 08 Jul 2021 14:45:04 GMT + - Tue, 04 Jan 2022 12:44:18 GMT Content-Type: - application/json; charset=utf-8 Transfer-Encoding: @@ -102,7 +102,7 @@ http_interactions: Pragma: - no-cache X-Request-Id: - - 3613fc6e-8364-44f1-b5ae-e4b92c4f17b6 + - e892def9-1834-47c8-aaf9-606eff0ba571 X-Freshdesk-Api-Version: - latest=v2; requested=v2 X-Rack-Cache: @@ -118,7 +118,7 @@ http_interactions: Expires: - Wed, 13 Oct 2010 00:00:00 UTC Set-Cookie: - - _helpkit_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJTNmMDYxMzM4YmI1MGE3NjdhMWM5YjMxODJjMDJiYjQ1BjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMU9rVTAybEdLVmVCc2ZXaGpERThtNHYyeERURHVrRllZYnRJT3ZkQnN4MHc9BjsARg%3D%3D--362eaa4142cd23acdd978a5d43af16884701199e; + - _helpkit_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJWZhMDViYWNmYmExMzMzMGYxMzU4NjVkYzg0YzA5MTUyBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMUQzTnE0aXNoRk1ZUGYrNVZMSXczM2ZWcmxPTUszQ0RhQVpoSmJWWDJWcEk9BjsARg%3D%3D--4f8eb3b59a5fefdd94b8a93109853862eb53224c; path=/; HttpOnly; secure - _x_w=5_2; path=/; HttpOnly; secure X-Fw-Ratelimiting-Managed: @@ -126,18 +126,92 @@ http_interactions: X-Ratelimit-Total: - '100' X-Ratelimit-Remaining: - - '90' + - '98' X-Ratelimit-Used-Currentrequest: - '1' X-Envoy-Upstream-Service-Time: - - '71' + - '59' X-Trace-Id: - - 00-0b4df5d88358f783274f4e709f735c1b-f919d65b8eb09b19-00 + - 00-85c6b8a2dac9fdeec2a484a02908bd44-002eab3aa99e9f1c-00 Server: - fwe body: encoding: ASCII-8BIT string: '{"available":false,"occasional":false,"id":80014400475,"ticket_scope":1,"signature":null,"group_ids":[],"role_ids":[80000198826],"skill_ids":[],"available_since":null,"contact":{"active":true,"email":"info@.org","job_title":null,"language":"en","mobile":null,"name":"Thorsten - Eckel","phone":null,"time_zone":"Eastern Time (US & Canada)","created_at":"2021-04-09T13:23:58Z","updated_at":"2021-04-09T13:31:00Z","last_login_at":"2021-06-07T05:38:22Z"},"created_at":"2021-04-09T13:23:58Z","updated_at":"2021-07-08T07:08:47Z","type":"support_agent"}' - recorded_at: Thu, 08 Jul 2021 14:45:04 GMT + Eckel","phone":null,"time_zone":"Eastern Time (US & Canada)","created_at":"2021-04-09T13:23:58Z","updated_at":"2021-04-09T13:31:00Z","last_login_at":"2021-10-07T17:33:11Z"},"created_at":"2021-04-09T13:23:58Z","updated_at":"2022-01-03T18:35:31Z","type":"support_agent"}' + recorded_at: Tue, 04 Jan 2022 12:44:18 GMT +- request: + method: get + uri: https://.freshdesk.com/api/v2/agents + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - ".freshdesk.com" + Authorization: + - Basic + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 04 Jan 2022 12:44:19 GMT + Content-Type: + - application/json; charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Status: + - 200 OK + Pragma: + - no-cache + X-Request-Id: + - db2c5bf7-1f2d-438e-bb4e-781d230ec791 + X-Freshdesk-Api-Version: + - latest=v2; requested=v2 + X-Rack-Cache: + - miss + Cache-Control: + - must-revalidate, no-cache, no-store, private, max-age=0 + X-Xss-Protection: + - 1; mode=block + X-Ua-Compatible: + - IE=Edge,chrome=1 + X-Content-Type-Options: + - nosniff + Expires: + - Wed, 13 Oct 2010 00:00:00 UTC + Set-Cookie: + - _x_w=5_2; path=/; HttpOnly; secure + X-Fw-Ratelimiting-Managed: + - 'true' + X-Ratelimit-Total: + - '100' + X-Ratelimit-Remaining: + - '97' + X-Ratelimit-Used-Currentrequest: + - '1' + X-Envoy-Upstream-Service-Time: + - '57' + X-Trace-Id: + - 00-2cb68ae4553a54506e56d015a155cf40-f61758316b28b76d-00 + Server: + - fwe + body: + encoding: ASCII-8BIT + string: '[{"available":false,"occasional":true,"id":80014400480,"ticket_scope":1,"created_at":"2021-04-09T13:24:01Z","updated_at":"2021-04-09T13:24:01Z","last_active_at":null,"available_since":null,"type":"support_agent","contact":{"active":false,"email":"custserv@freshdesk.com","job_title":null,"language":"en","last_login_at":null,"mobile":null,"name":"Customer + Service","phone":null,"time_zone":"Eastern Time (US & Canada)","created_at":"2021-04-09T13:24:01Z","updated_at":"2021-04-09T13:24:01Z"},"signature":null},{"available":false,"occasional":false,"id":80014400475,"ticket_scope":1,"created_at":"2021-04-09T13:23:58Z","updated_at":"2022-01-03T18:35:31Z","last_active_at":"2022-01-03T18:35:31Z","available_since":null,"type":"support_agent","contact":{"active":true,"email":"info@.org","job_title":null,"language":"en","last_login_at":"2021-10-07T17:33:11Z","mobile":null,"name":"Thorsten + Eckel","phone":null,"time_zone":"Eastern Time (US & Canada)","created_at":"2021-04-09T13:23:58Z","updated_at":"2021-04-09T13:31:00Z"},"signature":null}]' + recorded_at: Tue, 04 Jan 2022 12:44:19 GMT recorded_with: VCR 6.0.0