Commit 86bc491d authored by tleb's avatar tleb

Fix UV_endpoint auth

parent 4759551c
Pipeline #2111 passed with stage
in 31 minutes and 3 seconds
......@@ -12,10 +12,7 @@ from pedagogy.views import CanCreateUVFunctionMixin
@api_view(["GET"])
@renderer_classes((JSONRenderer,))
def uv_endpoint(request):
# is authenticated and has the right to create an UV
if not request.user.is_authenticated or not CanCreateUVFunctionMixin.can_create_uv(
request.user
):
if not CanCreateUVFunctionMixin.can_create_uv(request.user):
raise PermissionDenied
params = request.query_params
......
......@@ -38,7 +38,7 @@ def get_cached_user(request):
if not hasattr(request, "_cached_user"):
user = get_user(request)
if user.is_anonymous:
user = AnonymousUser(request)
user = AnonymousUser()
request._cached_user = user
......
......@@ -659,7 +659,7 @@ class User(AbstractBaseUser):
class AnonymousUser(AuthAnonymousUser):
def __init__(self, request):
def __init__(self):
super(AnonymousUser, self).__init__()
@property
......
......@@ -196,6 +196,8 @@ SASS_PRECISION = 8
WSGI_APPLICATION = "sith.wsgi.application"
REST_FRAMEWORK = {}
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
......@@ -252,6 +254,7 @@ LOGOUT_URL = "/logout"
LOGIN_REDIRECT_URL = "/"
DEFAULT_FROM_EMAIL = "bibou@git.an"
SITH_COM_EMAIL = "bibou_com@git.an"
REST_FRAMEWORK["UNAUTHENTICATED_USER"] = "core.models.AnonymousUser"
# Email
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment