User Tools

Site Tools


multiple_group_owners

Requirements

  • A group can have multiple group owners .
  • Active members can become group owners.
  • A group owner can add and remove himself and other members as/from owners .
  • A group owner can cancel his own membership and other owner’s membership aswell .

Present Design

  • Single group owner for each group .
  • Group owner info only present in Groups model as owner_id column.

Implementation

Approach

  • Handle the multiple group ownership privilege through group_membership model by adding an 'is_owner' column (type :boolean) in group membership model .
    • Members controller ⇒ add_to_group_owners action : updates the 'is_owner' flag of the respective membership record to true to grant group ownership privilege .
    • Members controller ⇒ remove_from_group_owners : updates the 'is_owner' flag of the respective membership record to false to remove group ownership privilege .
  • All group ownership related scenarios (for privileges to the group owner) and checks are now done through group_membership model (in contrast to referring the groups model under present implementation) .

Model Level Changes

The following methods were added in groups model to handle addition and removal of group members as owners .

  add_as_owner
     Updates the is_owner column of membership record to true.
  
  remove_as_owner
     Updates the is_owner column of membership record to false.

The following columns are added in existing tables :

Table name - group_membership

Column_name type Description
is_owner boolean when set indicates a member with owner privilege and when unset indicates a normal group member

Associations modified :

 User model :
 has_many :owned_groups, :through => :memberships , :source => :group , :conditions => ['is_owner = ?',true], :foreign_key => 'user_id'
 

Work Flow

  • Once a user creates a group , the membership record is created with the is_owner flag set to true .
  • An owner has the privilege to add other active members as owners or remove them from the owner list .
  • If a member is already a member of the group the 'Add to group owners' link changes to 'Remove from group owners'.
  • If the member is the only owner of the group , the 'Cancel' and 'Remove from group owners' links are disabled for him.
  • Owner being a group member also gets enrolled in the In Person Events → auto enroll option.

Note

  • User suspension and trasfering ownership scenario from Manage Site → User Management :
    • If the owned group of the user have multiple owners them the ownership of the groups are not changed .
    • If the owned group of the user do not have multiple owners , the the ownership is changed from transferror(current owner) to transferee(new owner) .
multiple_group_owners.txt · Last modified: 2018/08/31 16:16 (external edit)