Merge "Raise Exception when the paramter is invalid"
This commit is contained in:
@@ -68,6 +68,10 @@ class ActionController(wsgi.Controller):
|
||||
consts.PARAM_SORT: 'single',
|
||||
consts.PARAM_GLOBAL_PROJECT: 'single',
|
||||
}
|
||||
for key in req.params.keys():
|
||||
if (key not in param_whitelist.keys() and key not in
|
||||
filter_whitelist.keys()):
|
||||
raise exc.HTTPBadRequest(_('Invalid parameter %s') % key)
|
||||
params = util.get_allowed_params(req.params, param_whitelist)
|
||||
filters = util.get_allowed_params(req.params, filter_whitelist)
|
||||
|
||||
|
||||
@@ -139,6 +139,10 @@ class ClusterController(wsgi.Controller):
|
||||
consts.PARAM_SORT: 'single',
|
||||
consts.PARAM_GLOBAL_PROJECT: 'single',
|
||||
}
|
||||
for key in req.params.keys():
|
||||
if (key not in param_whitelist.keys() and key not in
|
||||
filter_whitelist.keys()):
|
||||
raise exc.HTTPBadRequest(_('Invalid parameter %s') % key)
|
||||
params = util.get_allowed_params(req.params, param_whitelist)
|
||||
filters = util.get_allowed_params(req.params, filter_whitelist)
|
||||
|
||||
|
||||
@@ -13,10 +13,12 @@
|
||||
"""
|
||||
Event endpoint for Senlin v1 ReST API.
|
||||
"""
|
||||
from webob import exc
|
||||
|
||||
from senlin.api.common import util
|
||||
from senlin.api.common import wsgi
|
||||
from senlin.common import consts
|
||||
from senlin.common.i18n import _
|
||||
from senlin.common import utils
|
||||
|
||||
|
||||
@@ -42,6 +44,10 @@ class EventController(wsgi.Controller):
|
||||
consts.PARAM_SORT: 'single',
|
||||
consts.PARAM_GLOBAL_PROJECT: 'single',
|
||||
}
|
||||
for key in req.params.keys():
|
||||
if (key not in param_whitelist.keys() and key not in
|
||||
filter_whitelist.keys()):
|
||||
raise exc.HTTPBadRequest(_('Invalid parameter %s') % key)
|
||||
params = util.get_allowed_params(req.params, param_whitelist)
|
||||
filters = util.get_allowed_params(req.params, filter_whitelist)
|
||||
|
||||
|
||||
@@ -77,6 +77,10 @@ class NodeController(wsgi.Controller):
|
||||
consts.PARAM_SORT: 'single',
|
||||
consts.PARAM_GLOBAL_PROJECT: 'single',
|
||||
}
|
||||
for key in req.params.keys():
|
||||
if (key not in param_whitelist.keys() and key not in
|
||||
filter_whitelist.keys()):
|
||||
raise exc.HTTPBadRequest(_('Invalid parameter %s') % key)
|
||||
params = util.get_allowed_params(req.params, param_whitelist)
|
||||
filters = util.get_allowed_params(req.params, filter_whitelist)
|
||||
|
||||
|
||||
@@ -79,6 +79,10 @@ class ReceiverController(wsgi.Controller):
|
||||
consts.PARAM_SORT: 'single',
|
||||
consts.PARAM_GLOBAL_PROJECT: 'single',
|
||||
}
|
||||
for key in req.params.keys():
|
||||
if (key not in param_whitelist.keys() and key not in
|
||||
filter_whitelist.keys()):
|
||||
raise exc.HTTPBadRequest(_('Invalid parameter %s') % key)
|
||||
params = util.get_allowed_params(req.params, param_whitelist)
|
||||
filters = util.get_allowed_params(req.params, filter_whitelist)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user