def METHOD_NAME(
    user: User,
    entity: Entity = None,
    entity_id: str = None,
) -> bool:
    return not user or \
        (not REQUIRE_USER_AUTHENTICATION and not is_test()) or \
        is_owner(user, entity, entity_id) or \
        (user.roles and user.roles & 1 != 0) or \
        (user and user.get_access(entity, entity_id) & Permission.Access.ADMIN != 0)