Class UserGroupMembership
In: app/models/user_group_membership.rb
Parent: ActiveRecord::Base

Models the relation between Users and UserGroups.

Methods

Public Instance methods

Sets the default admin-settings.

[Source]

    # File app/models/user_group_membership.rb, line 35
35:   def admin_settings=(give_admin_settings)
36:     if give_admin_settings
37:       self.role = Const::UserGroupMembership::ADMIN
38:     end
39:   end

Protected Instance methods

Gets rid of the user-group if it was personal

[Source]

    # File app/models/user_group_membership.rb, line 59
59:   def destroy_group_if_personal
60:     if self.user_group.personal?
61:       self.user_group.destroy
62:     end
63:     return true
64:   end

Called from user. Checks that the membership is not the only admin admin, and if it is, the User.admin user is made admin-member of this group.

[Source]

    # File app/models/user_group_membership.rb, line 49
49:   def pass_on_admin_role
50:     if self.user_group.memberships.select_by_role(Const::UserGroupMembership::ADMIN).size == 1
51:       self.user_group.memberships.create(:user => User.admin,
52:           :role => Const::UserGroupMembership::ADMIN)
53:     end
54:     return true
55:   end

[Validate]