summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGemeinschaft Service Account <gs5@localhost.localdomain>2013-02-24 06:02:29 -0500
committerGemeinschaft Service Account <gs5@localhost.localdomain>2013-02-24 06:02:29 -0500
commit966b8733a82f07f825ce07baff0d37e2a5863960 (patch)
treeb7cb36d5d9e8015643870b452f960b80e226ac31 /db
parent6acbd878be8b88f784a9813a9114773b87ee065f (diff)
add default groups
Diffstat (limited to 'db')
-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