Ejemplo n.º 1
0
 def update_store_acls(self, req, image_id, location_uri, public=False):
     if location_uri:
         try:
             read_tenants = []
             write_tenants = []
             members = registry.get_image_members(req.context, image_id)
             if members:
                 for member in members:
                     if member['can_share']:
                         write_tenants.append(member['member_id'])
                     else:
                         read_tenants.append(member['member_id'])
             store.set_acls(location_uri,
                            public=public,
                            read_tenants=read_tenants,
                            write_tenants=write_tenants,
                            context=req.context)
         except store.UnknownScheme:
             msg = _("Store for image_id not found: %s") % image_id
             raise webob.exc.HTTPBadRequest(explanation=msg,
                                            request=req,
                                            content_type='text/plain')
         except store.NotFound:
             msg = _("Data for image_id not found: %s") % image_id
             raise webob.exc.HTTPNotFound(explanation=msg,
                                          request=req,
                                          content_type='text/plain')
Ejemplo n.º 2
0
 def update_store_acls(self, req, image_id, location_uri, public=False):
     if location_uri:
         try:
             read_tenants = []
             write_tenants = []
             members = registry.get_image_members(req.context, image_id)
             if members:
                 for member in members:
                     if member['can_share']:
                         write_tenants.append(member['member_id'])
                     else:
                         read_tenants.append(member['member_id'])
             store.set_acls(location_uri, public=public,
                            read_tenants=read_tenants,
                            write_tenants=write_tenants,
                            context=req.context)
         except store.UnknownScheme:
             msg = _("Store for image_id not found: %s") % image_id
             raise webob.exc.HTTPBadRequest(explanation=msg,
                                            request=req,
                                            content_type='text/plain')
         except store.NotFound:
             msg = _("Data for image_id not found: %s") % image_id
             raise webob.exc.HTTPNotFound(explanation=msg,
                                          request=req,
                                          content_type='text/plain')