-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2748 from internetee/admin-contacts-in-settings-a…
…nd-validation feat: add admin contact ident type validation
- Loading branch information
Showing
15 changed files
with
456 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
db/migrate/20250204094550_add_admin_contacts_rules_to_settings.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
class AddAdminContactsRulesToSettings < ActiveRecord::Migration[6.1] | ||
def up | ||
unless SettingEntry.exists?(code: 'admin_contacts_required_for_org') | ||
SettingEntry.create!( | ||
code: 'admin_contacts_required_for_org', | ||
value: 'true', | ||
format: 'boolean', | ||
group: 'domain_validation' | ||
) | ||
else | ||
puts "SettingEntry admin_contacts_required_for_org already exists" | ||
end | ||
|
||
unless SettingEntry.exists?(code: 'admin_contacts_required_for_minors') | ||
SettingEntry.create!( | ||
code: 'admin_contacts_required_for_minors', | ||
value: 'true', | ||
format: 'boolean', | ||
group: 'domain_validation' | ||
) | ||
else | ||
puts "SettingEntry admin_contacts_required_for_minors already exists" | ||
end | ||
|
||
unless SettingEntry.exists?(code: 'admin_contacts_allowed_ident_type') | ||
SettingEntry.create!( | ||
code: 'admin_contacts_allowed_ident_type', | ||
value: { | ||
'birthday' => true, | ||
'priv' => true, | ||
'org' => false | ||
}.to_json, | ||
format: 'array', | ||
group: 'domain_validation' | ||
) | ||
else | ||
puts "SettingEntry admin_contacts_allowed_ident_type already exists" | ||
end | ||
end | ||
|
||
def down | ||
SettingEntry.where(code: [ | ||
'admin_contacts_required_for_org', | ||
'admin_contacts_required_for_minors', | ||
'admin_contacts_allowed_ident_type' | ||
]).destroy_all | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.