Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/organizations/organization_setting.rb')
-rw-r--r--app/models/organizations/organization_setting.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/models/organizations/organization_setting.rb b/app/models/organizations/organization_setting.rb
new file mode 100644
index 00000000000..108531e6701
--- /dev/null
+++ b/app/models/organizations/organization_setting.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+module Organizations
+ class OrganizationSetting < ApplicationRecord
+ belongs_to :organization
+
+ validates :settings, json_schema: { filename: "organization_settings" }
+
+ jsonb_accessor :settings,
+ restricted_visibility_levels: [:integer, { array: true }]
+
+ validates_each :restricted_visibility_levels do |record, attr, value|
+ value&.each do |level|
+ unless Gitlab::VisibilityLevel.options.value?(level)
+ record.errors.add(attr, format(_("'%{level}' is not a valid visibility level"), level: level))
+ end
+ end
+ end
+ end
+end