Added posts feed

This commit is contained in:
ITQ
2024-03-04 17:54:24 +03:00
parent 4946122f2e
commit fbf851e1a6
4 changed files with 87 additions and 6 deletions
+15
View File
@@ -15,3 +15,18 @@ class CanAccessPost(BasePermission):
return True
return False
class CanAccessFeed(BasePermission):
message = "You do not have permission to access this feed."
status_code = status.HTTP_404_NOT_FOUND
def has_object_permission(self, request, view, obj):
if (
obj.isPublic
or obj.check_for_friendship(request.user)
or obj == request.user
):
return True
return False