Deleting a Group
You can delete a group by executing the delete()
method.
When a group is deleted, all data that belong to this group (i.e. buckets, KiiObjects, and topics) will be automatically deleted.
To learn how to get the URI of a group, see Creating a Group.
Considerations in deleting users
Deleting a group owner does not automatically delete groups associated with the owner even if such groups has no member. Therefore, orphan groups and data of such groups can continue to consume space on your application.
To avoid possible confusion, you should be aware of the following points.
When you delete a group owner
A group will remain after you delete its owner. Since only a group owner can assign a new owner, and add and remove group members, no one will be able to manage the group.
To avoid the deadlock, implement one of the following steps together with the step of deleting a group owner:
- Change the group owner.
- Reject the deletion of the group owner and prompt to assign a new group owner.
- Delete the group with the owner.
When you delete the last group member
When the last group member is deleted, there will be of course no user in the group. You can still access the group via its URI, but you will not be able to access the group if the URI is lost (For referencing a group, see Retrieving a Group and Relationship between a User and a Group).
If your mobile app is not designed to save the group's URI, you need to carefully implement the user deletion. For example, you might want to implement the following logic:
- Get a list of groups that the user to be deleted is a member of.
- Get the members of each group on the list.
- When the user is deleted, delete groups whose sole member is the user.