Add config flag to bypass group authorisation for demo

This commit is contained in:
Yingtong Li 2019-01-12 15:31:53 +11:00
parent 5336a80125
commit 04093baf47
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 5 additions and 0 deletions

View File

@ -28,6 +28,8 @@ ALLOWED_HOSTS = []
PROMO_LOGO_URL = 'https://placehold.it/2000x500' PROMO_LOGO_URL = 'https://placehold.it/2000x500'
PROMO_LOGO_LINK = 'https://example.com' PROMO_LOGO_LINK = 'https://example.com'
ENFORCE_GROUP_MANAGERS = True
# Application definition # Application definition

View File

@ -16,6 +16,7 @@
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.conf import settings
from django.db import models from django.db import models
from jsonfield import JSONField from jsonfield import JSONField
@ -30,6 +31,8 @@ class Group(models.Model):
return self.name return self.name
def can_user_access(self, user): def can_user_access(self, user):
if not settings.ENFORCE_GROUP_MANAGERS:
return True
if user.is_superuser: if user.is_superuser:
return True return True
if user.email in self.managers: if user.email in self.managers: