This logic is extracted here to be used also with Sanic api.

def has_project_permissions(user: 'User', project: 'Project', request_method: str) -> bool:
    """This logic is extracted here to be used also with Sanic api."""
    # 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