Skip to content

Dev Guide

Dave edited this page Jun 5, 2022 · 3 revisions

Understanding ldapinator on a deeper level

Developer documentation is sparse at the moment. Most of what you will find is in comments alongside the code and the copious debug messages sprinkled throughout. I have tried to document as much as possible using the JSDoc format for functions and the Open API Specification (OAS) for the API routes.

The backend ldap-api.js is an Express application. The frontend is HTML/JavaScript/CSS without the use of a framework.

To see debug messages generated by the backend, run it with the debug command-line option like this: ldap-api.js -d. To see debug messages in the frontend, use your browser's developer tools to view the console.

API in a Nutshell

GET /index.html

retrieve the web client

GET /dn

return the attributes of the given DN as an object

[{
  "dn": "uid=test,ou=People,dc=home",
  "objectClass": ["posixAccount", "top", "inetOrgPerson"],
  "cn": ["test"],
  "description": "Limited Monkey",
  "displayName": "Klaus der Affe",
  "gidNumber": "11005",
  "givenName": "Klaus",
  "homeDirectory": "/home/test",
  "initials": "D",
  "mail": "[email protected]",
  "memberUid": [],
  "sn": "Affe",
  "uid": "test",
  "uidNumber": "11005"
}]

GET /dn?view=subordinate

return the leaf objects of the container as an array

[{
  "dn": "ou=Groups,dc=home",
  "description": "Groups of users",
  "classes": ["organizationalUnit"]
}, {
  "dn": "ou=People,dc=home",
  "description": "User accounts",
  "classes": ["organizationalUnit"]
}, {
  "dn": "cn=Manager,dc=home",
  "description": "LDAP Administrator",
  "classes": ["organizationalRole"]
}, {
  "dn": "uid=search,dc=home",
  "description": "Directory search user",
  "classes": ["inetOrgPerson", "posixAccount", "top"]
}]

PUT /dn

change an attribute of the given DN

The attribute is sent as a JSON object.

{
  "givenName": "Klaus"
}
Clone this wiki locally