[#2579] Sanitize order
This commit is contained in:
parent
314e9354c1
commit
670edc3279
1 changed files with 7 additions and 0 deletions
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue