From 966b8733a82f07f825ce07baff0d37e2a5863960 Mon Sep 17 00:00:00 2001 From: Gemeinschaft Service Account Date: Sun, 24 Feb 2013 06:02:29 -0500 Subject: add default groups --- db/migrate/20130224091700_add_initial_groups.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 db/migrate/20130224091700_add_initial_groups.rb (limited to 'db/migrate/20130224091700_add_initial_groups.rb') 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 -- cgit v1.2.3