[#2579] Sanitize order

This commit is contained in:
Frederic Merizen 2018-09-25 19:44:40 +02:00
parent 314e9354c1
commit 670edc3279

View file

@ -102,6 +102,7 @@ class DossierFieldService
table = procedure_presentation.sort['table'] table = procedure_presentation.sort['table']
column = procedure_presentation.sort['column'] column = procedure_presentation.sort['column']
order = procedure_presentation.sort['order'] order = procedure_presentation.sort['order']
assert_valid_order(order)
case table case table
when 'notifications' when 'notifications'
@ -147,6 +148,12 @@ class DossierFieldService
table + '.' + column table + '.' + column
end end
def assert_valid_order(order)
if !%w[asc desc].include?(order)
raise "Invalid order #{order}"
end
end
def field_hash(label, table, column) def field_hash(label, table, column)
{ {
'label' => label, 'label' => label,