Added also channel support, remove auto_wizard file after auto wizard has been done.

This commit is contained in:
Martin Edenhofer 2015-05-23 02:41:29 +02:00
parent 6f017e348c
commit 96fb303b7e
2 changed files with 37 additions and 2 deletions

View file

@ -25,6 +25,7 @@
], ],
"EmailAddresses": [ "EmailAddresses": [
{ {
"id": 1,
"realname": "Zammad Demo System", "realname": "Zammad Demo System",
"email": "zammad_demo@localhost" "email": "zammad_demo@localhost"
} }
@ -33,5 +34,19 @@
{ {
"name": "Demo Organization" "name": "Demo Organization"
} }
],
"Channels": [
{
"area": "Email::Inbound",
"adapter": "IMAP",
"group_id": 1,
"options": {
"host": "mx1.example.com",
"user": "some user",
"password": "some pw",
"ssl": true
},
"active":false
}
] ]
} }

View file

@ -48,7 +48,7 @@ returns
} }
) )
Organization.create_if_not_exists( Organization.create_or_update(
organization_data_symbolized organization_data_symbolized
) )
} }
@ -103,12 +103,32 @@ returns
} }
) )
EmailAddress.create_if_not_exists( EmailAddress.create_or_update(
email_address_data_symbolized email_address_data_symbolized
) )
} }
end end
# create Channels
if auto_wizard_hash['Channels']
auto_wizard_hash['Channels'].each { |channel_data|
channel_data_symbolized = channel_data.symbolize_keys.merge(
{
updated_by_id: admin_user.id,
created_by_id: admin_user.id
}
)
Channel.create(
channel_data_symbolized
)
}
end
# remove auto wizard file
FileUtils.rm auto_wizard_file_location
admin_user admin_user
end end
end end