Fixed bug: OTRS import fails for Roles without users assigned.

This commit is contained in:
Thorsten Eckel 2018-01-23 10:08:07 +01:00
parent ff93c7f22c
commit bef740612a

View file

@ -144,6 +144,7 @@ module Import
def groups_from_otrs_group(role_object, group) def groups_from_otrs_group(role_object, group)
result = [] result = []
return result if role_object.blank?
return result if role_object['GroupIDs'].blank? return result if role_object['GroupIDs'].blank?
permissions = role_object['GroupIDs'][ group['ID'] ] permissions = role_object['GroupIDs'][ group['ID'] ]
@ -165,7 +166,7 @@ module Import
roles = Import::OTRS::Requester.load('Role') roles = Import::OTRS::Requester.load('Role')
roles.each do |role| roles.each do |role|
next if !user['RoleIDs'].include?(role['ID']) next if !user['RoleIDs'].include?(role['ID'])
result += groups_from_otrs_groups(role['GroupIDs']) result += groups_from_otrs_groups(role)
end end
result result
end end