From bef740612ad47930cb3d7f186511628434da4d53 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 23 Jan 2018 10:08:07 +0100 Subject: [PATCH 1/2] Fixed bug: OTRS import fails for Roles without users assigned. --- lib/import/otrs/user.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/import/otrs/user.rb b/lib/import/otrs/user.rb index e6b2f2ecd..bf0258bcd 100644 --- a/lib/import/otrs/user.rb +++ b/lib/import/otrs/user.rb @@ -144,6 +144,7 @@ module Import def groups_from_otrs_group(role_object, group) result = [] + return result if role_object.blank? return result if role_object['GroupIDs'].blank? permissions = role_object['GroupIDs'][ group['ID'] ] @@ -165,7 +166,7 @@ module Import roles = Import::OTRS::Requester.load('Role') roles.each do |role| next if !user['RoleIDs'].include?(role['ID']) - result += groups_from_otrs_groups(role['GroupIDs']) + result += groups_from_otrs_groups(role) end result end From 225cf81ce2b452e019fd5e063445906a5ff2a2b0 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 23 Jan 2018 10:09:20 +0100 Subject: [PATCH 2/2] Fixed bug: OTRS import - User queue/group permissions are not transfered. --- lib/import/otrs/user.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/import/otrs/user.rb b/lib/import/otrs/user.rb index bf0258bcd..be086603c 100644 --- a/lib/import/otrs/user.rb +++ b/lib/import/otrs/user.rb @@ -96,6 +96,7 @@ module Import queues.each do |queue| permissions = user['GroupIDs'][ queue['GroupID'] ] + permissions ||= user['GroupIDs'][ queue['GroupID'].to_s ] next if !permissions next if !permissions.include?('rw')