Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

16627 - fix check for team membership deactivation #2652

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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