Revise profile sorting

We are using a new schema for sorting profiles. This patch replaces the
'sort_keys' and the 'sort_dir' parameter with a single 'sort' parameter.
It also fixes multi-tenancy problem with profile listing.

Change-Id: If2bf9d60c056e8101b86fcaa48f85e2d60554adc
Closes-Bug: #1530748
This commit is contained in:
tengqm
2016-01-08 04:08:38 -05:00
parent 07f22506b4
commit aa9154a503
10 changed files with 61 additions and 82 deletions

View File

@@ -75,8 +75,8 @@ class ProfileController(object):
param_whitelist = {
'limit': 'single',
'marker': 'single',
'sort_dir': 'single',
'sort_keys': 'multi',
'sort': 'single',
'global_project': 'single',
}
params = util.get_allowed_params(req.params, param_whitelist)
filters = util.get_allowed_params(req.params, filter_whitelist)
@@ -85,11 +85,16 @@ class ProfileController(object):
if key in params:
params[key] = utils.parse_int_param(key, params[key])
key = consts.PARAM_GLOBAL_PROJECT
if key in params:
project_safe = not utils.parse_bool_param(key, params[key])
del params[key]
params['project_safe'] = project_safe
if not filters:
filters = None
profiles = self.rpc_client.profile_list(req.context,
filters=filters,
profiles = self.rpc_client.profile_list(req.context, filters=filters,
**params)
return {'profiles': profiles}