blob: 108531e67011589d1f2ae06402439cf34e90c464 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
|