From 57aff93284bff196b37d0deb995ff46d4708bbda Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Tue, 6 Sep 2011 17:38:48 -0400 Subject: reverting change to GlanceImageService._is_image_available --- nova/image/glance.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/nova/image/glance.py b/nova/image/glance.py index 25af8baa1..804d27fbf 100644 --- a/nova/image/glance.py +++ b/nova/image/glance.py @@ -276,7 +276,23 @@ class GlanceImageService(object): an auth_token. """ - return hasattr(context, 'auth_token') and context.auth_token + if hasattr(context, 'auth_token') and context.auth_token: + return True + + if image_meta['is_public'] or context.is_admin: + return True + + properties = image_meta['properties'] + + 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) # utility functions -- cgit