Commit a21928d0 authored by James Lopez's avatar James Lopez

add ldap filter validation to ldap group link and update controller

parent 2ee8f590
......@@ -43,6 +43,6 @@ class Groups::LdapGroupLinksController < Groups::ApplicationController
end
def ldap_group_link_params
params.require(:ldap_group_link).permit(:cn, :group_access, :provider)
params.require(:ldap_group_link).permit(:cn, :filter, :group_access, :provider)
end
end
......@@ -2,8 +2,11 @@ class LdapGroupLink < ActiveRecord::Base
include Gitlab::Access
belongs_to :group
validates :cn, :group_access, :group_id, presence: true
validates :cn, uniqueness: { scope: [:group_id, :provider] }
validates :cn, :group_access, :group_id, presence: true, unless: :filter
validates :cn, uniqueness: { scope: [:group_id, :provider] }, unless: :filter
validates :filter, :group_access, :group_id, presence: true, unless: :cn
validates :filter, uniqueness: { scope: [:group_id, :provider] }, unless: :cn
validates :filter, ldap_filter: true
validates :group_access, inclusion: { in: Gitlab::Access.all_values }
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