mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 05:26:17 +02:00
feat: add admin contact ident type validation
- Add new setting for allowed admin contact ident types - Add validation for admin contact ident types on domain create/update - Add UI controls for managing allowed ident types - Add tests for new validation rules - Update domain model to respect new settings The changes allow configuring which identification types (private person, organization, birthday) are allowed for administrative contacts. This is enforced when creating new domains or adding new admin contacts.
This commit is contained in:
parent
b641235bbd
commit
f2978599b4
12 changed files with 346 additions and 11 deletions
|
@ -27,12 +27,25 @@ module Admin
|
|||
|
||||
def casted_settings
|
||||
settings = {}
|
||||
|
||||
|
||||
params[:settings].each do |k, v|
|
||||
settings[k] = { value: v }
|
||||
setting = SettingEntry.find(k)
|
||||
value = if setting.format == 'array'
|
||||
processed_hash = available_options.each_with_object({}) do |option, hash|
|
||||
hash[option] = (v[option] == "true")
|
||||
end
|
||||
processed_hash.to_json
|
||||
else
|
||||
v
|
||||
end
|
||||
settings[k] = { value: value }
|
||||
end
|
||||
|
||||
|
||||
settings
|
||||
end
|
||||
|
||||
def available_options
|
||||
%w[birthday priv org]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue