summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-03-27 10:31:08 +0100
committerPeter Kozak <spag@golwen.net>2013-03-27 10:31:08 +0100
commita634e8b158dac11250181d7cae35a08afbea96d4 (patch)
tree4695f1dc418ae9016ac56ccf7a6f2d6959d9a0e2 /app/controllers
parentd5ac8f72af16fa5487ab1e16bf784e8125a7b450 (diff)
create voicemail account for newly crested users
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/users_controller.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 584d08c..ea8ed69 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -22,6 +22,12 @@ class UsersController < ApplicationController
def create
@user = @parent.users.build(params[:user])
if @user.save
+ if VoicemailAccount.where(:name => "user_#{@user.user_name}").count == 0
+ @user.voicemail_accounts.create(:name => "user_#{@user.user_name}", :active => true )
+ else
+ @user.voicemail_accounts.create(:active => true)
+ end
+
if @parent.class == Tenant
@parent.tenant_memberships.create(:user => @user)
if @parent.user_groups.exists?(:name => 'Users')