Skip to content

Commit

Permalink
16627 - fix check for team membership deactivation (bcgov#2652)
Browse files Browse the repository at this point in the history
  • Loading branch information
ochiu authored Nov 28, 2023
1 parent f7ee5cf commit ab5a10d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion auth-api/src/auth_api/services/membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,13 @@ def deactivate_membership(self, **kwargs):
"""Mark this membership as inactive."""
current_app.logger.debug('<deactivate_membership')
user_from_context: UserContext = kwargs['user_context']

# if this is a member removing another member, check that they admin or owner
if self._model.user.username != user_from_context.user_name:
check_auth(org_id=self._model.org_id, one_of_roles=(COORDINATOR, ADMIN))

# check to ensure that owner isn't removed by anyone but an owner
if self._model.membership_type == ADMIN:
if self._model.membership_type_code == ADMIN:
check_auth(org_id=self._model.org_id, one_of_roles=(ADMIN)) # pylint: disable=superfluous-parens

self._model.membership_status = MembershipStatusCodeModel.get_membership_status_by_code('INACTIVE')
Expand Down
2 changes: 1 addition & 1 deletion auth-api/src/auth_api/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
Development release segment: .devN
"""

__version__ = '2.9.2' # pylint: disable=invalid-name
__version__ = '2.9.3' # pylint: disable=invalid-name

0 comments on commit ab5a10d

Please sign in to comment.