def has_project_permissions(user: '<STR_LIT>', project: '<STR_LIT>', request_method: str) -> bool:
<EOL>if user.is_staff or user.is_superuser or project.user == user:<EOL><INDENT>return True<EOL><DEDENT>return request_method in permissions.SAFE_METHODS and project.is_public<EOL>
This logic is extracted here to be used also with Sanic api.