From 3b5439ef74618a19ded79a44873010700c12acf0 Mon Sep 17 00:00:00 2001 From: Piotr Dobrowolski Date: Thu, 28 May 2020 21:53:58 +0200 Subject: [PATCH] auth: fix broken deletion permission on non-superusers --- auth/pipeline.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/auth/pipeline.py b/auth/pipeline.py index 8895810..494913f 100644 --- a/auth/pipeline.py +++ b/auth/pipeline.py @@ -1,8 +1,13 @@ from social_core.pipeline.social_auth import associate_by_email +from django.contrib.auth.models import Group def staff_me_up(backend, details, response, uid, user, *args, **kwargs): user.is_staff = True + try: + user.groups.set([Group.objects.get(name='member')]) + except Group.DoesNotExist: + pass user.save()