gs.group.member.leave.base API

The published API for the gs.group.member.leave.base product consists of the GroupLeaver class and the leave_group() function.

class gs.group.member.leave.base.GroupLeaver(groupInfo, userInfo)

Handle leaving a group.

Parameters:
  • groupInfo (Products.GSGroup.interfaces.IGSGroupInfo) – The group the member should leave
  • userInfo (Products.CustomUserFolder.intefaces.IGSUserInfo) – The member leaving the group.
removeMember()

Remove a member from a group

Returns:A description of what occurred.
Return type:str

The GroupLeaver.removeMember() method removes the member from the group, and clears the positions that they may have had in the group: moderator, group administrator, participation coach, and moderated member.

The email settings of the member are left unchanged.

Todo

posting member, and email settings should be cleared?

gs.group.member.leave.base.leave_group(groupInfo, userInfo, request)

Utility function to remove someone from a group.

Parameters:
  • groupInfo (Products.GSGroup.interfaces.IGSGroupInfo) – The group the member should leave
  • userInfo (Products.CustomUserFolder.intefaces.IGSUserInfo) – The member leaving the group.
  • request (zope.publisher.interfaces.browser.IBrowserRequest) – The current browser request.

The leave_group() function

  • Removes the member from a group,
  • Sends a notification (Notifications) to the member that they have left, and
  • Sends a notification to all the administrators that the member has left the group.

Example

The code is not as sophisticated as the Joining User code. The GroupLeaver is instantiated, and the GroupLeaver.removeMember() method is called.

leaver = GroupLeaver(self.groupInfo, self.loggedInUser)
leaver.removeMember()

More useful is the leave_group() utility function, which is used by the user-interfaces to remove a person from a group and people that the member has left.

leave_group(self.groupInfo, userInfo, self.request)