'Check image availability.
This check is needed in case Nova and Glance are deployed
without authentication turned on.'

@staticmethod
def _is_image_available(context, image):

    if (hasattr(context, 'auth_token') and context.auth_token):
        return True
    if (image.is_public or context.is_admin):
        return True
    properties = image.properties
    if (context.project_id and ('owner_id' in properties)):
        return (str(properties['owner_id']) == str(context.project_id))
    if (context.project_id and ('project_id' in properties)):
        return (str(properties['project_id']) == str(context.project_id))
    try:
        user_id = properties['user_id']
    except KeyError:
        return False
    return (str(user_id) == str(context.user_id))
