Commit 701c9e8e authored by Calum Mackervoy's avatar Calum Mackervoy Committed by Jean-Baptiste Pasquier

fixed bug with AnonymousUsers in permissions

parent 228b22af
......@@ -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