def request_can_view_datastore(info, datastore, check_if_owner=True):
    """Check to see if a GraphQL context can view a datastore.
    """
    if check_if_owner and info.context.user.is_owner(info.context.workspace.id):
        return True
    # If the datastore does not have object permissions enabled, we can just return it.
    if not datastore.object_permissions_enabled:
        return True
    # Otherwise, we need to check if the specific user has access to the datastore.
    return info.context.user.has_perm('definitions.view_datastore', datastore)