Skip to content

Commit

Permalink
fix: add UserIsManagerError to the Raises clause of group_repo.remove…
Browse files Browse the repository at this point in the history
…_member() docstring
  • Loading branch information
chisholm committed Nov 13, 2024
1 parent cec4e80 commit 98d70ec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/dioptra/restapi/db/repository/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,14 +487,16 @@ def remove_member(self, group: Group, user: User) -> None:
EntityDeletedError: if the group or user is deleted
GroupNeedsAUserError: if removal would leave the group userless
UserNeedsAGroupError: if removal would leave the user groupless
UserIsManagerError: if there are sufficient members and memberships
to remove the user, but the user is a manager of the group
"""

# Consistency rules:
# - A group must have at least one member
# - A group must have at least one manager
# - A group manager must be a member
# - A user must be in at least one group

# TODO: ensure the member being removed is not also manager

assert_group_exists(self.session, group, DeletionPolicy.NOT_DELETED)
assert_user_exists(self.session, user, DeletionPolicy.NOT_DELETED)

Expand Down

0 comments on commit 98d70ec

Please sign in to comment.