Activity log for bug #1413146

Date Who What changed Old value New value Message
2015-01-21 10:25:14 whhw bug added bug
2015-01-21 10:26:00 whhw glance: assignee whhw (wanghuan2)
2015-01-21 10:47:25 whhw description When admin user list images, we add admin_ad_user=False to query images that are owned by the user, shared to the user and other public images, instead of list all the images. But if I add this to v2 command like: curl -i -X GET -H 'X-Auth-Token:07abcf7d5a4d4ad6a03570b73d7ab98a' http://172.30.101.153:9292/v2/images?admin_as_user=True the result will always be empty, like: {"images": [], "schema": "/v2/schemas/images", "first": "/v2/images?admin_as_user=True"} It is because the index of v2 inplementation does not accept 'admin_as_user', instead all the other parameters that are not present will be passed into 'filters'. [glance/api/v2/images.py] def index(self, req, marker=None, limit=None, sort_key='created_at', sort_dir='desc', filters=None, member_status='accepted'): A simple method to fix is, add this code to image_get_all(), so we can get it from the filters before querying database. [glance/db/sqlachemy/api.py]: def image_get_all(context, filters=None, marker=None, limit=None, sort_key='created_at', sort_dir='desc', member_status='accepted', is_public=None, admin_as_user=False, return_tag=False): ...... # added if 'admin_as_user' in filters: admin_as_user = filters.pop('admin_as_user') if admin_as_user.lower() == 'true': admin_as_user = True else: admin_as_user = False When admin user list images, we add admin_as_user=False to query images that are owned by the user, shared to the user and other public images, instead of list all the images. But if I add this to v2 command like: curl -i -X GET -H 'X-Auth-Token:07abcf7d5a4d4ad6a03570b73d7ab98a' http://172.30.101.153:9292/v2/images?admin_as_user=True the result will always be empty, like: {"images": [], "schema": "/v2/schemas/images", "first": "/v2/images?admin_as_user=True"} It is because the index of v2 implementation does not accept 'admin_as_user', instead all the other parameters that are not present will be passed into 'filters'. [glance/api/v2/images.py]: def index(self, req, marker=None, limit=None, sort_key='created_at',           sort_dir='desc', filters=None, member_status='accepted'): A simple method to fix is, add this code to image_get_all(), so we can get it from the filters before querying database. [glance/db/sqlachemy/api.py]: def image_get_all(context, filters=None, marker=None, limit=None,                   sort_key='created_at', sort_dir='desc',                   member_status='accepted', is_public=None,                   admin_as_user=False, return_tag=False): ...... # added if 'admin_as_user' in filters: admin_as_user = filters.pop('admin_as_user') admin_as_user = (admin_as_user.lower() == 'true')
2015-01-21 17:41:30 Dong Liu bug added subscriber Dong Liu
2015-01-22 14:42:33 Ian Cordasco glance: status New Incomplete
2015-02-10 13:07:45 Erno Kuvaja glance: importance Undecided Wishlist
2015-02-11 03:23:26 Ian Cordasco summary Glance v2 index dose not support 'admin_as_user' parameter Glance v2 index does not support 'admin_as_user' parameter