Update seeds to work with new roles requirements

This commit is contained in:
Priit Tark 2015-04-22 13:33:02 +03:00
parent 510bde7d53
commit 82fd2db963

View file

@ -39,29 +39,35 @@ ApiUser.where(
registrar: registrar2 registrar: registrar2
).first_or_create! ).first_or_create!
AdminUser.where( admin1 = {
username: 'user1', username: 'user1',
password: 'test1', password: 'test1',
email: 'user1@example.ee', email: 'user1@example.ee',
identity_code: '37810013855', identity_code: '37810013855',
country_code: 'EE' country_code: 'EE'
).first_or_create! }
admin2 = {
AdminUser.where(
username: 'user2', username: 'user2',
password: 'test2', password: 'test2',
email: 'user2@example.ee', email: 'user2@example.ee',
identity_code: '37810010085', identity_code: '37810010085',
country_code: 'EE' country_code: 'EE'
).first_or_create! }
admin3 = {
AdminUser.where(
username: 'user3', username: 'user3',
password: 'test3', password: 'test3',
email: 'user3@example.ee', email: 'user3@example.ee',
identity_code: '37810010727', identity_code: '37810010727',
country_code: 'EE' country_code: 'EE'
).first_or_create! }
[admin1, admin2, admin3].each do |at|
admin = AdminUser.where(at)
next if admin.present?
admin = AdminUser.new(at)
admin.roles = ['admin']
admin.save
end
ZonefileSetting.where({ ZonefileSetting.where({
origin: 'ee', origin: 'ee',
@ -85,8 +91,6 @@ ZonefileSetting.where({
master_nameserver: 'ns.tld.ee' master_nameserver: 'ns.tld.ee'
}).first_or_create! }).first_or_create!
AdminUser.update_all(roles: ['admin'])
Registrar.where( Registrar.where(
name: 'EIS', name: 'EIS',
reg_no: '90010019', reg_no: '90010019',