Skip to content

Commit

Permalink
permissions on activity (#8992)
Browse files Browse the repository at this point in the history
Co-authored-by: owocki <[email protected]>
  • Loading branch information
gdixon and owocki authored Jun 3, 2021
1 parent 60b22ec commit 3d0de86
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/townsquare/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,14 @@ def api(request, activity_id):

# deletion request
if request.POST.get('method') == 'delete':
activity.delete()
has_perms = False
if request.user.is_authenticated:
if activity.profile and request.user.profile.pk == activity.profile.pk:
has_perms = True
if activity.other_profile and request.user.other_profile.pk == activity.other_profile.pk:
has_perms = True
if has_perms:
activity.delete()

# deletion request
if request.POST.get('method') == 'vote':
Expand Down

0 comments on commit 3d0de86

Please sign in to comment.