diff --git a/contrib/auto_wizzard_example.json b/contrib/auto_wizzard_example.json index 0c990aa24..351e99c32 100644 --- a/contrib/auto_wizzard_example.json +++ b/contrib/auto_wizzard_example.json @@ -17,5 +17,11 @@ "name": "product_name", "value": "Zammad Demo System" } + ], + "EmailAddresses": [ + { + "realname": "Zammad Demo System", + "email": "zammad@localhost", + } ] } \ No newline at end of file diff --git a/lib/auto_wizzard.rb b/lib/auto_wizzard.rb index 2da922dd2..de699c21b 100644 --- a/lib/auto_wizzard.rb +++ b/lib/auto_wizzard.rb @@ -2,7 +2,7 @@ module AutoWizzard =begin -creates or updates Users and sets Settings based on the 'auto_wizzard.json' file placed in the root directory. +creates or updates Users, EmailAddresses and sets Settings based on the 'auto_wizzard.json' file placed in the root directory. there is an example file 'contrib/auto_wizzard_example.json' @@ -60,6 +60,26 @@ returns } end + # add EmailAddresses + if auto_wizzard_hash['EmailAddresses'] + + auto_wizzard_hash['EmailAddresses'].each { |email_address_data| + + email_address_data_symbolized = email_address_data.symbolize_keys + + email_address_data_symbolized = email_address_data_symbolized.merge( + { + :updated_by_id => 1, + :created_by_id => 1 + } + ) + + EmailAddress.create_if_not_exists( + email_address_data_symbolized + ) + } + end + true end end \ No newline at end of file