Commit 200b70f2 authored by James Lopez's avatar James Lopez

update validation

parent 915ac40d
...@@ -5,18 +5,18 @@ class LdapGroupLink < ActiveRecord::Base ...@@ -5,18 +5,18 @@ class LdapGroupLink < ActiveRecord::Base
BLANK_ATTRIBUTES = %w[cn filter].freeze BLANK_ATTRIBUTES = %w[cn filter].freeze
with_options if: :cn do |link| with_options if: :cn do |link|
link.validates :cn, :group_access, :group_id, presence: true
link.validates :cn, uniqueness: { scope: [:group_id, :provider] } link.validates :cn, uniqueness: { scope: [:group_id, :provider] }
link.validates :cn, presence: true
link.validates :filter, absence: true link.validates :filter, absence: true
end end
with_options if: :filter do |link| with_options if: :filter do |link|
link.validates :filter, :group_access, :group_id, presence: true
link.validates :filter, uniqueness: { scope: [:group_id, :provider] } link.validates :filter, uniqueness: { scope: [:group_id, :provider] }
link.validates :filter, ldap_filter: true link.validates :filter, ldap_filter: true, presence: true
link.validates :cn, absence: true link.validates :cn, absence: true
end end
validates :group_access, :group_id, presence: true
validates :group_access, inclusion: { in: Gitlab::Access.all_values } validates :group_access, inclusion: { in: Gitlab::Access.all_values }
validates :provider, presence: true validates :provider, presence: true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment