/api/v1/ldap/search:
  post:
    summary: Perform an LDAP search with provided LDAP server information
    description: This will cause the Packetfence server to perform an LDAP search on the provided LDAP server with the provided information
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - scope
            properties:
              server:
                $ref: '#/components/schemas/ConfigSourceSubTypeLdap'
              search_query:
                type: object
                properties:
                  filter:
                    type: string
                    example: "(cn=*doe*)"
                  base_dn:
                    type: string
                    example: dc=ip,dc=linodeusercontent,dc=com
                  scope:
                    type: string
                    enum: [ base, one, sub ]
                    example: base
                  attributes:
                    type: array
                    items:
                      type: string
                    example: [cn, uid,  displayName]
                  size_limit:
                    type: integer
                    example: 100
                  time_limit:
                    type: integer
                    example: 60
    responses:
      '200':
        description: Request successful. Response contains LDAP entries.
        content:
          application/json:
            schema:
              type: object
              description: Map of LDAP entries. The key is the DN of the entry and the value is the entry.
              additionalProperties:
                type: object
                description: LDAP entry.
                additionalProperties:
                  type: object
                  description: All attributes requested in query. Attribute value can be of any type.
              example: {"uid=jdoe,ou=people,dc=ip,dc=linodeusercontent,dc=com": {"cn": "John", "uid": "jdoe", "displayName": "John Doe"}, "uid=jdoem,ou=people,dc=ip,dc=linodeusercontent,dc=com": {"cn": "JohnM", "uid": "jdoem", "displayName": "John Doe Mathew"}}
      '401':
        $ref: "#/components/responses/Unauthorized"
      '400':
        $ref: "#/components/responses/BadRequest"
    tags:
      - LDAP
