summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Waldon <brian.waldon@rackspace.com>2011-09-06 17:38:48 -0400
committerBrian Waldon <brian.waldon@rackspace.com>2011-09-06 17:38:48 -0400
commit57aff93284bff196b37d0deb995ff46d4708bbda (patch)
treeb91c72812307c809054cf828bbb0f37820666bab
parent0f1db545f1a3c8b016cd7bcf21813019262b9b7a (diff)
downloadnova-57aff93284bff196b37d0deb995ff46d4708bbda.tar.gz
nova-57aff93284bff196b37d0deb995ff46d4708bbda.tar.xz
nova-57aff93284bff196b37d0deb995ff46d4708bbda.zip
reverting change to GlanceImageService._is_image_available
-rw-r--r--nova/image/glance.py18
1 files changed, 17 insertions, 1 deletions
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