Skip to content

Conversation

@evanpurkhiser
Copy link
Member

@evanpurkhiser evanpurkhiser commented Jul 18, 2019

This is a replacement for the web.frontend.admin endpoint that is used
in the admin manage interface (primarily for open source sentry) to hard
delete accounts.

I'll add a few more tests to be 100% sure things are right here. But am
looking for some API review from people who write APIs more than me

Specifically trying to remove this

def remove_user(request, user_id):
if six.text_type(user_id) == six.text_type(request.user.id):
return HttpResponseRedirect(absolute_uri('/manage/users/'))
try:
user = User.objects.get(pk=user_id)
except User.DoesNotExist:
return HttpResponseRedirect(absolute_uri('/manage/users/'))
form = RemoveUserForm(request.POST or None)
if form.is_valid():
if form.cleaned_data['removal_type'] == '2':
user.delete()
else:
User.objects.filter(pk=user.pk).update(is_active=False)
return HttpResponseRedirect(absolute_uri('/manage/users/'))

@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/refapi-update-delete-users-to-support-hard-deleting branch from d3bd468 to 7261436 Compare July 18, 2019 20:00
This is a replacement for the web.frontend.admin endpoint that is used
in the admin manage interface (primarily for open source sentry) to hard
delete accounts.
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/refapi-update-delete-users-to-support-hard-deleting branch from 7261436 to 0f8e16d Compare July 18, 2019 20:12
OrganizationMember.objects.filter(
organization__in=remaining_org_ids,
user=request.user,
user=user,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This used to just assume you were deleting yourself, this updates things so you can delete someone else (with the proper authorization of course, which happens in UserEndpoint)

@evanpurkhiser evanpurkhiser merged commit 43ed1e1 into master Jul 18, 2019
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/refapi-update-delete-users-to-support-hard-deleting branch July 18, 2019 22:26
HazAT added a commit that referenced this pull request Jul 19, 2019
* master:
  ref(admin): Convert user edit page to react (#14074)
  ref: Remove unused Group.get_oldest_event and legacy events behavior (#14038)
  ref(api): Update DELETE users/ to support hard deleting (#14068)
  test(OrganizationDiscoverSavedQueryDetailTest): Stabilize put test (#14077)
  meta(readme): Sentry logo should link to sentry.io (#14076)
  ref: Remove duplicate column (#14073)
  App platform/update permissions token auth (#14046)
  feat: Support issue IDs as canonical parameters
  ref: Change to new traceparent header for Python SDK (#14070)
  feat: Use option to force-disable transaction events (#14056)
  feat(apm): Register option to force-disable transaction events (#14055)
  Feat/mark sentry app installed put route (#14060)
  ref: Remove unused Group.event_set property  (#14036)
  fix: Filter out groups that are pending deletion/merge from `by_qualified_short_id` (SEN-849)
  fix(ui): Fix resolve/ignore actions for accounts without multi… (#14058)
  Fix: Remove extra $.param introduced in GH-14051 (#14061)
  feat: Use Snuba for Group.from_event_id (#14034)
  fix(ui) Display implicit default sort and default to descending (#14042)
  fix(github) Fix 404s not being handled in repository search (#14030)
  fix: Pass an empty array to $.param instead of an empty string when options.query is falsey (#14051)

# Conflicts:
#	src/sentry/utils/sdk.py
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants