diff --git a/core/users/user_imports.php b/core/users/user_imports.php index ee348fec54..a3c04cd5bc 100644 --- a/core/users/user_imports.php +++ b/core/users/user_imports.php @@ -306,8 +306,10 @@ } if ($field_name == "group_name") { + $group_name = ''; foreach ($groups as $field) { if ($field['group_name'] == $result[$key]) { + $group_name = $field['group_name']; $array['group_users'][$row_id]['group_user_uuid'] = uuid(); $array['group_users'][$row_id]['domain_uuid'] = $domain_uuid; $array['group_users'][$row_id]['group_name'] = $field['group_name']; @@ -315,6 +317,13 @@ $array['group_users'][$row_id]['user_uuid'] = $user_uuid; } } + + //remove superadmin if not the correct permission + if ($group_name == 'superadmin') { + if (!permission_exists('group_domain')) { + unset($array['group_users'][$row_id]); + } + } } } }