Files
gitlabhq/lib/api/ldap.rb
T
Jan-Willem van der Meer 6059e0683a 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
2014-10-08 16:03:11 +02:00

22 lines
665 B
Ruby

module API
# groups API
class Ldap < Grape::API
before { authenticate! }
resource :ldap do
# Get a LDAP groups list. Limit size to 20 of them.
# Filter results by name using search param
#
# Example Request:
# GET /ldap/groups
get 'groups' do
# 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
end
end