code: def has_project_permissions(user: 'User', project: 'Project', request_method: str) -> bool:
      
      # Superusers and the creator is allowed to do everything
      if user.is_staff or user.is_superuser or project.user == user:
          return True
  
      # Other user
      return request_method in permissions.SAFE_METHODS and project.is_public
docs: This logic is extracted here to be used also with Sanic api.