[#2750] Make ProcedurePresentation checks private
This commit is contained in:
parent
40a5ff0266
commit
026c322fce
1 changed files with 30 additions and 30 deletions
|
@ -12,36 +12,6 @@ class ProcedurePresentation < ApplicationRecord
|
|||
validate :check_allowed_sort_column
|
||||
validate :check_allowed_filter_columns
|
||||
|
||||
def check_allowed_displayed_fields
|
||||
displayed_fields.each do |field|
|
||||
table = field['table']
|
||||
column = field['column']
|
||||
if !valid_column?(table, column)
|
||||
errors.add(:filters, "#{table}.#{column} n’est pas une colonne permise")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def check_allowed_sort_column
|
||||
table = sort['table']
|
||||
column = sort['column']
|
||||
if !valid_sort_column?(table, column)
|
||||
errors.add(:sort, "#{table}.#{column} n’est pas une colonne permise")
|
||||
end
|
||||
end
|
||||
|
||||
def check_allowed_filter_columns
|
||||
filters.each do |_, columns|
|
||||
columns.each do |column|
|
||||
table = column['table']
|
||||
column = column['column']
|
||||
if !valid_column?(table, column)
|
||||
errors.add(:filters, "#{table}.#{column} n’est pas une colonne permise")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def fields
|
||||
fields = [
|
||||
field_hash('Créé le', 'self', 'created_at'),
|
||||
|
@ -163,6 +133,36 @@ class ProcedurePresentation < ApplicationRecord
|
|||
|
||||
private
|
||||
|
||||
def check_allowed_displayed_fields
|
||||
displayed_fields.each do |field|
|
||||
table = field['table']
|
||||
column = field['column']
|
||||
if !valid_column?(table, column)
|
||||
errors.add(:filters, "#{table}.#{column} n’est pas une colonne permise")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def check_allowed_sort_column
|
||||
table = sort['table']
|
||||
column = sort['column']
|
||||
if !valid_sort_column?(table, column)
|
||||
errors.add(:sort, "#{table}.#{column} n’est pas une colonne permise")
|
||||
end
|
||||
end
|
||||
|
||||
def check_allowed_filter_columns
|
||||
filters.each do |_, columns|
|
||||
columns.each do |column|
|
||||
table = column['table']
|
||||
column = column['column']
|
||||
if !valid_column?(table, column)
|
||||
errors.add(:filters, "#{table}.#{column} n’est pas une colonne permise")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_value(dossier, table, column)
|
||||
assert_valid_column(table, column)
|
||||
|
||||
|
|
Loading…
Reference in a new issue