Make ldap/groups API call backwards compatible

It now just returns the results of the first server. A new call will replace
the existing to get results for a specific provider
parent f8c8ae29
......@@ -330,6 +330,6 @@ test:
user_filter: ''
group_base: 'ou=groups,dc=example,dc=com'
admin_group: ''
sync_ssh_keys: sshpublickey
sync_ssh_keys: false
staging:
<<: *base
......@@ -10,7 +10,10 @@ module API
# Example Request:
# GET /ldap/groups
get 'groups' do
@groups = Gitlab::LDAP::Adapter.new.groups("#{params[:search]}*", 20)
# NOTE: this should be deprecated in favour of /ldap/PROVIDER_NAME/groups
# for now we just select the first LDAP server
provider = Gitlab::LDAP::Config.servers.first.provider_name
@groups = Gitlab::LDAP::Adapter.new(provider).groups("#{params[:search]}*", 20)
present @groups, with: Entities::LdapGroup
end
end
......
......@@ -4,6 +4,14 @@ module Gitlab
class Config
attr_accessor :provider, :options
def self.enabled?
Gitlab.config.ldap.enabled
end
def servers
Gitlab.config.ldap.servers
end
def initialize(provider)
@provider = provider
@options = config_for(provider)
......
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