diff --git a/access/middleware.py b/access/middleware.py index edbb907..ed280f9 100644 --- a/access/middleware.py +++ b/access/middleware.py @@ -2,13 +2,15 @@ from django.http import HttpResponseForbidden class CheckPerm(object): - @staticmethod def process_request(request): - if '/admin' in request.path or '/management' in request.path or '/analytics' in request.path: + if '/admin' in request.path or "/management" in request.path \ + or '/analytics' in request.path: + if not request.user.is_authenticated(): return HttpResponseForbidden() - if not (request.user.in_role == "M" or request.user.in_role == "S" or request.user.in_role == "A" or request.user.is_admin): - return HttpResponseForbidden() + if not (request.user.in_role == "M" or request.user.in_role == "S" + or request.user.in_role == "A" or request.user.is_admin): + return HttpResponseForbidden() diff --git a/lms/settings.py b/lms/settings.py index ed6cce3..6d0e179 100644 --- a/lms/settings.py +++ b/lms/settings.py @@ -137,7 +137,7 @@ DATABASES = { 'NAME': os.environ.get('DB_NAME', 'codemy'), 'USER': os.environ.get('PG_ENV_POSTGRES_USER', 'team'), 'PASSWORD': os.environ.get('PG_ENV_POSTGRES_PASSWORD', 'nu5Xefise'), - 'HOST': os.environ.get('PG_PORT_5432_TCP_ADDR', '127.0.0.1'), + 'HOST': os.environ.get('PG_PORT_5432_TCP_ADDR', '192.168.0.6'), 'PORT': os.environ.get('PG_PORT_5432_TCP_PORT', '5432'), }, }