summaryrefslogtreecommitdiff
path: root/db/migrate/20130224091700_add_initial_groups.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20130224091700_add_initial_groups.rb')
-rw-r--r--db/migrate/20130224091700_add_initial_groups.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/db/migrate/20130224091700_add_initial_groups.rb b/db/migrate/20130224091700_add_initial_groups.rb
new file mode 100644
index 0000000..f680fb6
--- /dev/null
+++ b/db/migrate/20130224091700_add_initial_groups.rb
@@ -0,0 +1,22 @@
+class AddInitialGroups < ActiveRecord::Migration
+ def up
+ Group.create(:name => 'admins', :active => true, :comment => 'Administrator user accounts')
+ Group.create(:name => 'users', :active => true, :comment => 'Generic user accounts')
+ Group.create(:name => 'tenant_sip_accounts', :active => true, :comment => 'SIP accounts owned by tenants')
+
+ user_sip_accounts = Group.create(:name => 'user_sip_accounts', :active => true, :comment => 'SIP accounts owned by user accounts')
+ user_sip_accounts.group_permissions.create(:permission => 'pickup', :target_group_id => user_sip_accounts.id)
+
+ Group.create(:name => 'international_calls', :active => true, :comment => 'International calls permitted')
+ Group.create(:name => 'national_calls', :active => true, :comment => 'National calls permitted')
+
+ GsParameter.create(:entity => 'group', :section => 'default', :name => 'User.admin', :value => '--- [admins]\n', :class_type => 'YAML')
+ GsParameter.create(:entity => 'group', :section => 'default', :name => 'User', :value => '--- [users]\n', :class_type => 'YAML')
+ GsParameter.create(:entity => 'group', :section => 'default', :name => 'SipAccount.user', :value => '--- [user_sip_accounts, international_calls, national_calls]\n', :class_type => 'YAML')
+ GsParameter.create(:entity => 'group', :section => 'default', :name => 'SipAccount.tenant', :value => '--- [tenant_sip_accounts]\n', :class_type => 'YAML')
+ end
+
+ def down
+ Group.destroy_all
+ end
+end