Update v1/v2 images APIs to set store ACLs.

Updates the images controllers so they call set_acls on
the backend store when adding/updating images and members.

Made some changes to the v2 API unit/functional tests to
use real locations instead of just UUIDs so the tests work
with the new set_acls call.

Partially implements blueprint: swift-tenant-specific-storage.

Change-Id: Ib249acfe440f4b75bc9edd7b73fe10127b8333b1
This commit is contained in:
Dan Prince
2012-07-01 21:18:28 -04:00
parent eeedad3333
commit 480743a2d7
11 changed files with 145 additions and 14 deletions

View File

@@ -296,3 +296,16 @@ def schedule_delete_from_backend(uri, context, image_id, **kwargs):
def add_to_backend(context, scheme, image_id, data, size):
store = get_store_from_scheme(context, scheme)
return store.add(image_id, data, size)
def set_acls(context, location_uri, public=False, read_tenants=[],
write_tenants=[]):
scheme = get_store_from_location(location_uri)
store = get_store_from_scheme(context, scheme)
try:
store.set_acls(location.get_location_from_uri(location_uri),
public=public,
read_tenants=read_tenants,
write_tenants=write_tenants)
except NotImplementedError:
LOG.debug(_("Skipping store.set_acls... not implemented."))