Commit 68422fef authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier

Merge branch 'permissions-anonymous-users' into 'master'

fixed bug with AnonymousUsers in permissions

See merge request !22
parents 228b22af 701c9e8e
Pipeline #6750 passed with stage
in 27 seconds
......@@ -15,6 +15,10 @@ def is_user_admin_of_project(user, project):
class ProjectPermissions(LDPPermissions):
def has_permission(self, request, view):
# anonymous users have no rights
if request.user.is_anonymous:
return False
# request on an existing resource - this will be reviewed by has_object_permission
if request.method == 'PATCH' or request.method == 'DELETE' or request.method == 'PUT':
return True
......@@ -42,6 +46,10 @@ class ProjectMemberPermissions(LDPPermissions):
def has_permission(self, request, view):
from djangoldp.models import Model
# anonymous users have no rights
if request.user.is_anonymous:
return False
# request on an existing resource - this will be reviewed by has_object_permission
if request.method == 'PATCH' or request.method == 'DELETE' or request.method == 'PUT':
return True
......
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