summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-24 14:09:31 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-24 14:09:31 +0100
commite024c99b6ffeb725cf73ebf8b7b55957f36772f5 (patch)
tree36ce89c477055f33245a62f8455a4af5eb27a8de /app/models/user.rb
parentea3df5a7eb079982a8fcda3df572a0d1433b7f52 (diff)
A new user becomes a member of default UserGroups.
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index b902b99..9e8cbc0 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -95,6 +95,8 @@ class User < ActiveRecord::Base
before_destroy :destroy_or_logout_phones
+ after_save :become_a_member_of_default_user_groups
+
def destroy
clean_whitelist_entries
super
@@ -207,4 +209,12 @@ class User < ActiveRecord::Base
end
end
+ # Normaly a new user should become a member of default user groups.
+ #
+ def become_a_member_of_default_user_groups
+ UserGroup.where(:id => GsParameter.get('DEFAULT_USER_GROUPS_IDS')).each do |user_group|
+ user_group.user_group_memberships.create(:user_id => self.id)
+ end
+ end
+
end