aboutsummaryrefslogtreecommitdiff
path: root/crowdrest/backend.py
diff options
context:
space:
mode:
Diffstat (limited to 'crowdrest/backend.py')
-rw-r--r--crowdrest/backend.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/crowdrest/backend.py b/crowdrest/backend.py
index 6b3a3b3..c0900d6 100644
--- a/crowdrest/backend.py
+++ b/crowdrest/backend.py
@@ -116,14 +116,18 @@ class CrowdRestBackend(object):
group_names = [group_map.get(x, x) for x in group_names]
group_names = set(group_names)
- if getattr(settings, "AUTH_CROWD_SUPERUSER_GROUP", None) in group_names:
- user.is_superuser = True
- else:
- user.is_superuser = False
- if getattr(settings, "AUTH_CROWD_STAFF_GROUP", None) in group_names:
- user.is_staff = True
- else:
- user.is_staff = False
+ su_group = getattr(settings, "AUTH_CROWD_SUPERUSER_GROUP", None)
+ if su_group:
+ if su_group in group_names:
+ user.is_superuser = True
+ else:
+ user.is_superuser = False
+ staff_group = getattr(settings, "AUTH_CROWD_STAFF_GROUP", None)
+ if staff_group:
+ if staff_group in group_names:
+ user.is_staff = True
+ else:
+ user.is_staff = False
if getattr(settings, "AUTH_CROWD_CREATE_GROUPS", False):
group_objs = [Group.objects.get_or_create(name=g)[0] for g in group_names]