ldap-rest 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +31 -21
  2. package/docs/README.md +23 -486
  3. package/docs/{DEVELOPER_GUIDE.md → client-development/README.md} +24 -24
  4. package/docs/client-development/api/README.md +75 -0
  5. package/docs/client-development/browser/README.md +65 -0
  6. package/docs/{plugins/DEVELOPMENT.md → plugin-development/README.md} +4 -9
  7. package/docs/plugin-development/hooks.md +18 -0
  8. package/docs/usage/README.md +89 -0
  9. package/docs/usage/configuration.md +375 -0
  10. package/docs/usage/plugins/README.md +87 -0
  11. package/docs/usage/plugins/auth/README.md +65 -0
  12. package/docs/usage/plugins/auth/crowdsec.md +95 -0
  13. package/docs/usage/plugins/auth/hmac.md +293 -0
  14. package/docs/usage/plugins/auth/llng.md +99 -0
  15. package/docs/usage/plugins/auth/oidc.md +167 -0
  16. package/docs/usage/plugins/auth/rate-limit.md +62 -0
  17. package/docs/usage/plugins/auth/token.md +136 -0
  18. package/docs/usage/plugins/auth/totp.md +213 -0
  19. package/docs/usage/plugins/auth/trusted-proxy.md +127 -0
  20. package/docs/usage/plugins/integrations/README.md +42 -0
  21. package/docs/usage/plugins/ldap/README.md +79 -0
  22. package/docs/usage/troubleshooting.md +105 -0
  23. package/package.json +5 -1
  24. package/docs/authentication.md +0 -1194
  25. /package/docs/{OPENAPI.md → client-development/api/openapi.md} +0 -0
  26. /package/docs/{api/REFERENCE.md → client-development/api/reference.md} +0 -0
  27. /package/docs/{api/REST_API.md → client-development/api/rest-api.md} +0 -0
  28. /package/docs/{browser/LIBRARIES.md → client-development/browser/libraries.md} +0 -0
  29. /package/docs/{examples/EXAMPLES.md → client-development/examples/README.md} +0 -0
  30. /package/docs/{examples → client-development/examples/ldif}/twake-mailbox-type-nomenclature.ldif +0 -0
  31. /package/docs/{examples → client-development/examples/ldif}/twake-mailbox-type-schema-amendment.ldif +0 -0
  32. /package/docs/{schemas/SCHEMAS.md → client-development/schemas/README.md} +0 -0
  33. /package/docs/{PLUGIN_DEPENDENCIES.md → plugin-development/dependencies.md} +0 -0
  34. /package/docs/{testing-with-embedded-ldap.md → plugin-development/testing.md} +0 -0
  35. /package/docs/{presenterm.md → presentations/en.md} +0 -0
  36. /package/docs/{presenterm-fr.md → presentations/fr.md} +0 -0
  37. /package/docs/{authzLinid1.md → usage/plugins/auth/authz-linid1.md} +0 -0
  38. /package/docs/{authzPerBranch.md → usage/plugins/auth/authz-per-branch.md} +0 -0
  39. /package/docs/{twakeAppAccountsApi.md → usage/plugins/integrations/app-accounts.md} +0 -0
  40. /package/docs/{twakeCalendarResources.md → usage/plugins/integrations/calendar-resources.md} +0 -0
  41. /package/docs/{twakeJames.md → usage/plugins/integrations/james-mail.md} +0 -0
  42. /package/docs/{jamesTeamMailboxes.md → usage/plugins/integrations/james-mailboxes.md} +0 -0
  43. /package/docs/{ldapBulkImport.md → usage/plugins/ldap/bulk-import.md} +0 -0
  44. /package/docs/{ldapExternalUsersInGroups.md → usage/plugins/ldap/external-users.md} +0 -0
  45. /package/docs/{ldapFlatGeneric.md → usage/plugins/ldap/flat-generic.md} +0 -0
  46. /package/docs/{ldapGroups.md → usage/plugins/ldap/groups.md} +0 -0
  47. /package/docs/{onChange.md → usage/plugins/ldap/on-change.md} +0 -0
  48. /package/docs/{ldapOrganizations.md → usage/plugins/ldap/organizations.md} +0 -0
  49. /package/docs/{ldapTrash.md → usage/plugins/ldap/trash.md} +0 -0
  50. /package/docs/{static.md → usage/plugins/utilities/static.md} +0 -0
  51. /package/docs/{weblogs.md → usage/plugins/utilities/weblogs.md} +0 -0
package/README.md CHANGED
@@ -10,12 +10,12 @@ Core plugins also provide plugins that ensure LDAP data consistency.
10
10
 
11
11
  ## Key Features
12
12
 
13
- - 🔒 **Robust Error Handling** - Server stays online even when plugins encounter errors
14
- - 🔌 **Plugin Architecture** - Extensible through a powerful plugin system
15
- - 🔐 **Flexible Authentication** - Support for multiple authentication methods
16
- - 📊 **REST API** - Complete LDAP operations through REST endpoints
17
- - 🎯 **Event Hooks** - Intercept and customize LDAP operations
18
- - 🌐 **Browser Libraries** - Ready-to-use JavaScript components
13
+ - **Robust Error Handling** - Server stays online even when plugins encounter errors
14
+ - **Plugin Architecture** - Extensible through a powerful plugin system
15
+ - **Flexible Authentication** - Support for multiple authentication methods
16
+ - **REST API** - Complete LDAP operations through REST endpoints
17
+ - **Event Hooks** - Intercept and customize LDAP operations
18
+ - **Browser Libraries** - Ready-to-use JavaScript components
19
19
 
20
20
  ## How it works
21
21
 
@@ -53,29 +53,39 @@ LDAP-Rest uses syslog-style log levels:
53
53
 
54
54
  Use `--log-level notice` for production to see web access logs without general info messages.
55
55
 
56
- ## Command-line options and environment variables
56
+ ## Configuration
57
57
 
58
- [ToDo]
59
-
60
- See also [Typescript declarations](./src/config/args.ts).
58
+ See **[Configuration Guide](./docs/usage/configuration.md)** for all CLI options and environment variables.
61
59
 
62
60
  ## Documentation
63
61
 
64
- ### For Application Developers
62
+ Documentation is organized into 3 categories:
63
+
64
+ ### [Usage](./docs/usage/README.md)
65
+
66
+ Installation, configuration and plugin usage.
67
+
68
+ - **[Getting Started](./docs/usage/README.md)** - Quick start guide
69
+ - **[Configuration](./docs/usage/configuration.md)** - CLI options and environment variables
70
+ - **[Plugins](./docs/usage/plugins/README.md)** - Plugin documentation
71
+ - **[Authentication](./docs/usage/plugins/auth/README.md)** - Token, TOTP, HMAC, LemonLDAP::NG, OpenID Connect
72
+
73
+ ### [Plugin Development](./docs/plugin-development/README.md)
65
74
 
66
- - **[Developer Guide](./docs/DEVELOPER_GUIDE.md)** - Complete guide for building web applications using LDAP-Rest APIs and browser libraries
67
- - **[Browser Examples](./examples/web/)** - Interactive demos of browser libraries (TOTP client, LDAP tree viewer, etc.)
75
+ Create and extend LDAP-Rest with custom plugins.
68
76
 
69
- ### For Plugin Developers
77
+ - **[Development Guide](./docs/plugin-development/README.md)** - Architecture and plugin creation
78
+ - **[Hooks](./docs/plugin-development/hooks.md)** - LDAP hooks system
79
+ - **[Contributing](./CONTRIBUTING.md)** - Contribution guide
70
80
 
71
- - **[Contributing Guide](./CONTRIBUTING.md)** - How to contribute and develop plugins
72
- - [Plugins](./src/plugins/README.md)
73
- - [Hooks](./HOOKS.md)
81
+ ### [Client Application Development](./docs/client-development/README.md)
74
82
 
75
- ### Authentication
83
+ Integrate LDAP-Rest into your web applications.
76
84
 
77
- - **[Authentication Guide](./docs/authentication.md)** - Token, TOTP, LemonLDAP::NG, OpenID Connect
78
- - **[TOTP Client Demo](./examples/web/totp-client.html)** - Interactive TOTP generator and API client
85
+ - **[REST API](./docs/client-development/api/rest-api.md)** - Complete API reference
86
+ - **[Browser Libraries](./docs/client-development/browser/libraries.md)** - Web components
87
+ - **[Examples](./docs/client-development/examples/README.md)** - React, Vue.js, Vanilla JS
88
+ - **[Browser Demos](./examples/web/)** - Interactive demos (TOTP client, LDAP tree viewer)
79
89
 
80
90
  ## Copyright and license
81
91
 
@@ -83,4 +93,4 @@ See also [Typescript declarations](./src/config/args.ts).
83
93
 
84
94
  Copyright 2025-present [LINAGORA](https://linagora.com)
85
95
 
86
- Licensed under [GNU AGPL-3.0](./LICENSE])
96
+ Licensed under [GNU AGPL-3.0](./LICENSE)
package/docs/README.md CHANGED
@@ -1,509 +1,46 @@
1
1
  # LDAP-Rest Documentation
2
2
 
3
- Complete documentation for ldap-rest plugins and features.
3
+ Complete documentation for LDAP-Rest, organized by use case.
4
4
 
5
- ## Presentations
6
-
7
- Interactive slide presentations about LDAP-Rest (using [presenterm](https://github.com/mfontanini/presenterm)):
8
-
9
- - **[presenterm.md](./presenterm.md)** - English presentation
10
- - **[presenterm-fr.md](./presenterm-fr.md)** - Présentation en français
11
-
12
- To view:
13
-
14
- ```bash
15
- presenterm docs/presenterm.md # English
16
- presenterm docs/presenterm-fr.md # French
17
- ```
18
-
19
- Topics covered:
20
-
21
- - Architecture and plugin system
22
- - LDAP consistency mechanisms
23
- - Apache James integration
24
- - REST API and JSON schemas
25
- - Browser libraries
26
- - Use cases and examples
27
-
28
- ## For Application Developers
29
-
30
- If you want to build a web application that uses LDAP-Rest's APIs and browser libraries:
31
-
32
- 📖 **[Developer Guide](./DEVELOPER_GUIDE.md)** - Complete guide covering:
33
-
34
- - REST API reference (Config, Users, Groups, Organizations)
35
- - Browser libraries (LdapTreeViewer, LdapUserEditor)
36
- - JSON schemas and roles
37
- - Integration examples (React, Vue.js, Vanilla JavaScript)
38
- - Authentication and security
39
-
40
- ## For Plugin Developers
41
-
42
- If you want to extend LDAP-Rest with custom plugins, see below:
43
-
44
- ## Table of Contents
45
-
46
- ### Core Plugins
47
-
48
- #### LDAP Management
49
-
50
- - **[ldapFlatGeneric](ldapFlatGeneric.md)** - Schema-driven LDAP entity management (users, positions, etc.)
51
- - **[ldapGroups](ldapGroups.md)** - LDAP group management with member validation
52
- - **[ldapOrganizations](ldapOrganizations.md)** - Hierarchical organization tree management
53
- - **[ldapBulkImport](ldapBulkImport.md)** - CSV-based bulk import for LDAP resources
54
- - **[ldapExternalUsersInGroups](ldapExternalUsersInGroups.md)** - Auto-create external contacts in groups
55
- - **[ldapTrash](ldapTrash.md)** - Soft delete system - moves entries to trash instead of deleting
56
- - **[onChange](onChange.md)** - Detect and react to LDAP attribute changes
57
-
58
- #### Authentication & Authorization
59
-
60
- - **[authentication](authentication.md)** - Complete authentication guide (Token, LLNG, OpenID Connect)
61
- - **[authzPerBranch](authzPerBranch.md)** - Branch-level authorization and access control
62
- - **[authzLinid1](authzLinid1.md)** - LinID 1.x authorization integration
63
-
64
- #### Security
65
-
66
- - **crowdsec** - CrowdSec integration to block banned IPs (must be loaded before auth plugins)
67
- - **rateLimit** - Rate limiting to prevent brute-force attacks (must be loaded before auth plugins)
68
-
69
- #### Utilities
70
-
71
- - **[static](static.md)** - Serve static files and JSON schemas with config replacement
72
- - **[weblogs](weblogs.md)** - HTTP request logging and monitoring
73
-
74
- ### Integration Plugins
75
-
76
- #### Twake
77
-
78
- - **[twakeJames](twakeJames.md)** - Apache James mail server synchronization
79
- - **[twakeCalendarResources](twakeCalendarResources.md)** - Twake Calendar resources synchronization
80
- - **[twakeAppAccountsApi](twakeAppAccountsApi.md)** - Applicative accounts API (device/app-specific accounts)
81
-
82
- ## Quick Start
83
-
84
- ### Basic LDAP Server
85
-
86
- Minimal setup with user management:
87
-
88
- ```bash
89
- ldap-rest \
90
- --plugin core/ldap/flatGeneric \
91
- --ldap-url ldap://localhost:389 \
92
- --ldap-dn "cn=admin,dc=example,dc=com" \
93
- --ldap-pwd "password" \
94
- --ldap-base "dc=example,dc=com" \
95
- --ldap-flat-schema ./schemas/standard/users.json
96
- ```
97
-
98
- ### With Authentication
99
-
100
- Add token authentication:
101
-
102
- ```bash
103
- ldap-rest \
104
- --plugin core/auth/token \
105
- --plugin core/ldap/flatGeneric \
106
- --auth-token "secret-token" \
107
- --ldap-flat-schema ./schemas/standard/users.json \
108
- ...
109
- ```
110
-
111
- ### Complete Setup
112
-
113
- Full-featured LDAP management with web UI:
114
-
115
- ```bash
116
- ldap-rest \
117
- --plugin core/auth/token \
118
- --plugin core/ldap/flatGeneric \
119
- --plugin core/ldap/groups \
120
- --plugin core/ldap/organization \
121
- --plugin core/ldap/bulkImport \
122
- --plugin core/ldap/externalUsersInGroups \
123
- --plugin core/static \
124
- --plugin core/weblogs \
125
- --ldap-flat-schema ./schemas/standard/users.json \
126
- --bulk-import-schemas "users:./schemas/standard/users.json" \
127
- --auth-token "admin-token" \
128
- --static-path ./static \
129
- ...
130
- ```
131
-
132
- ## Plugin Categories
133
-
134
- ### LDAP Entities
135
-
136
- Plugins for managing different LDAP entity types:
137
-
138
- | Plugin | Entity Type | Features |
139
- | ---------------------- | ------------------------ | --------------------------------------------- |
140
- | core/ldap/flatGeneric | Users, Positions, Custom | Schema-driven, Validation, Pointers |
141
- | core/ldap/groups | Groups | Member validation, Nested groups |
142
- | core/ldap/organization | Organizational Units | Tree navigation, Search |
143
- | core/ldap/bulkImport | Any (bulk operations) | CSV import, Template generation, Multi-schema |
144
- | core/ldap/trash | Any (soft delete) | Trash system, Recovery, Metadata |
145
-
146
- ### Authentication
147
-
148
- Secure API access:
149
-
150
- | Plugin | Type | Use Case |
151
- | ------------------------ | ------------- | ---------------------------- |
152
- | core/auth/token | Bearer tokens | Development, APIs, Scripts |
153
- | core/auth/llng | LemonLDAP::NG | Enterprise SSO |
154
- | core/auth/openidconnect | OAuth2/OIDC | Cloud identity, Social login |
155
- | core/auth/authzPerBranch | Authorization | Branch-level access control |
156
- | core/auth/authzLinid1 | Authorization | LinID 1.x integration |
157
-
158
- ### Security
159
-
160
- Protection and rate limiting:
161
-
162
- | Plugin | Type | Use Case |
163
- | ------------------- | ------------- | ----------------------------- |
164
- | core/auth/crowdsec | IP blocking | Block banned IPs via CrowdSec |
165
- | core/auth/rateLimit | Rate limiting | Prevent brute-force attacks |
166
-
167
- ### Integration
168
-
169
- Connect to external systems:
170
-
171
- | Plugin | Integrates With | Purpose |
172
- | ------------------------------- | --------------- | ------------------------ |
173
- | core/ldap/onChange | Any | Detect LDAP changes |
174
- | core/twake/james | Apache James | Mail server sync |
175
- | core/twake/appAccountsApi | LDAP | App-specific account API |
176
- | core/ldap/externalUsersInGroups | Groups | Auto-create contacts |
177
-
178
- ### Utilities
179
-
180
- Support plugins:
181
-
182
- | Plugin | Purpose |
183
- | ------------ | --------------------- |
184
- | core/static | Serve web UI, schemas |
185
- | core/weblogs | Request logging |
186
-
187
- ## Plugin Dependencies
188
-
189
- Some plugins require others:
190
-
191
- ```
192
- core/twake/james
193
- └─ requires: core/ldap/onChange
194
-
195
- core/ldap/externalUsersInGroups
196
- └─ requires: core/ldap/groups
197
-
198
- core/auth/authzPerBranch
199
- └─ requires: Any authentication plugin (core/auth/token, core/auth/llng, core/auth/openidconnect)
200
- ```
201
-
202
- ## Configuration
203
-
204
- ### Environment Variables
205
-
206
- All CLI options can be set via environment variables:
207
-
208
- ```bash
209
- # LDAP connection
210
- export DM_LDAP_URL="ldap://localhost:389" # or multiple URLs for failover
211
- export DM_LDAP_DN="cn=admin,dc=example,dc=com"
212
- export DM_LDAP_PWD="password"
213
- export DM_LDAP_BASE="dc=example,dc=com"
214
-
215
- # Plugins
216
- export DM_PLUGIN="core/auth/token,core/ldap/flatGeneric"
217
- export DM_AUTH_TOKENS="token1,token2"
218
- export DM_LDAP_FLAT_SCHEMA="./schemas/users.json"
219
-
220
- # Logging
221
- export DM_LOG_LEVEL="notice" # error, warn, notice, info, debug
222
-
223
- # Start server
224
- ldap-rest
225
- ```
226
-
227
- ### LDAP Failover
228
-
229
- LDAP-Rest supports multiple LDAP servers for high availability. Provide multiple URLs separated by commas:
230
-
231
- ```bash
232
- # Command line
233
- --ldap-url ldap://ldap1.example.com,ldap://ldap2.example.com,ldap://ldap3.example.com
5
+ ## Documentation Categories
234
6
 
235
- # Or via environment variable
236
- export DM_LDAP_URL="ldap://ldap1.example.com,ldap://ldap2.example.com,ldap://ldap3.example.com"
237
- ```
7
+ ### [Usage](usage/README.md)
238
8
 
239
- The system will:
9
+ Installation, configuration and plugin usage.
240
10
 
241
- 1. Try to connect to each URL in order
242
- 2. Use the first successful connection
243
- 3. Automatically failover to the next URL if the current connection fails
244
- 4. Log failover events for monitoring
11
+ - **[Getting Started](usage/README.md)** - Quick start guide
12
+ - **[Configuration](usage/configuration.md)** - CLI options and environment variables
13
+ - **[Plugins](usage/plugins/README.md)** - Documentation for all available plugins
245
14
 
246
- ### Log Levels
15
+ ### [Plugin Development](plugin-development/README.md)
247
16
 
248
- LDAP-Rest uses syslog-style log levels:
17
+ Create and extend LDAP-Rest with custom plugins.
249
18
 
250
- ```bash
251
- --log-level error # Only errors
252
- --log-level warn # Warnings and errors
253
- --log-level notice # Web access logs (recommended for production)
254
- --log-level info # General info + web logs + warnings + errors
255
- --log-level debug # All messages including debug output
256
- ```
19
+ - **[Development Guide](plugin-development/README.md)** - Architecture and plugin creation
20
+ - **[Hooks](plugin-development/hooks.md)** - LDAP hooks system
21
+ - **[Testing](plugin-development/testing.md)** - Testing with embedded LDAP
22
+ - **[Dependencies](plugin-development/dependencies.md)** - Plugin dependencies matrix
257
23
 
258
- The **notice** level is ideal for production as it shows web access logs without flooding with general info messages.
24
+ ### [Client Application Development](client-development/README.md)
259
25
 
260
- ### Configuration Files
26
+ Integrate LDAP-Rest into your web applications.
261
27
 
262
- Use `.env` files or shell scripts:
28
+ - **[REST API](client-development/api/rest-api.md)** - Complete API reference
29
+ - **[Browser Libraries](client-development/browser/libraries.md)** - Web components (LdapTreeViewer, LdapUserEditor, etc.)
30
+ - **[JSON Schemas](client-development/schemas/README.md)** - Schema structure and validation
31
+ - **[Examples](client-development/examples/README.md)** - React, Vue.js, Vanilla JS integration
263
32
 
264
- ```bash
265
- # Load configuration
266
- source ~/.ldap-rest-config
267
-
268
- # Start server
269
- ldap-rest
270
- ```
271
-
272
- ## Schemas
273
-
274
- ### Standard Schemas
275
-
276
- Located in `./static/schemas/standard/`:
277
-
278
- - `users.json` - Standard inetOrgPerson users
279
- - `groups.json` - Standard groupOfNames groups
280
- - `organizations.json` - Organizational units
281
-
282
- ### Twake Schemas
283
-
284
- Located in `./static/schemas/twake/`:
285
-
286
- - `users.json` - Twake users with custom attributes
287
- - `groups.json` - Twake static groups
288
- - `positions.json` - Twake positions/roles
289
- - `organizations.json` - Twake organizations
290
- - `nomenclature/*.json` - Reference data (status, delivery mode, etc.)
291
-
292
- ### Active Directory Schemas
293
-
294
- Located in `./static/schemas/ad/`:
295
-
296
- - `users.json` - AD user accounts
297
- - `groups.json` - AD security groups
298
- - `organizations.json` - AD organizational units
299
-
300
- ## API Endpoints
301
-
302
- ### Entity Management
303
-
304
- Generated by `ldapFlatGeneric`:
305
-
306
- ```
307
- GET /api/v1/ldap/{pluralName} # List entries
308
- GET /api/v1/ldap/{pluralName}/{id} # Get entry
309
- POST /api/v1/ldap/{pluralName} # Create entry
310
- PUT /api/v1/ldap/{pluralName}/{id} # Modify entry
311
- DELETE /api/v1/ldap/{pluralName}/{id} # Delete entry
312
- ```
313
-
314
- ### Groups
315
-
316
- Provided by `ldapGroups`:
317
-
318
- ```
319
- GET /api/v1/ldap/groups # List groups
320
- GET /api/v1/ldap/groups/{cn} # Get group
321
- POST /api/v1/ldap/groups # Create group
322
- PUT /api/v1/ldap/groups/{cn} # Modify group
323
- POST /api/v1/ldap/groups/{cn}/rename # Rename group (change cn)
324
- POST /api/v1/ldap/groups/{cn}/move # Move group to different organization
325
- DELETE /api/v1/ldap/groups/{cn} # Delete group
326
- ```
327
-
328
- ### Organizations
329
-
330
- Provided by `ldapOrganizations`:
331
-
332
- ```
333
- GET /api/v1/ldap/organizations/top # Get top organization(s)
334
- GET /api/v1/ldap/organizations/{dn}/subnodes # List sub-organizations and linked entities
335
- GET /api/v1/ldap/organizations/{dn}/subnodes/search # Search in organization
336
- POST /api/v1/ldap/organizations # Create organization
337
- PUT /api/v1/ldap/organizations/{dn} # Modify organization
338
- POST /api/v1/ldap/organizations/{dn}/move # Move organization to different parent
339
- DELETE /api/v1/ldap/organizations/{dn} # Delete organization
340
- ```
341
-
342
- ### Bulk Import
343
-
344
- Provided by `ldapBulkImport`:
345
-
346
- ```
347
- GET /api/v1/ldap/bulk-import/{resource}/template.csv # Generate CSV template from schema
348
- POST /api/v1/ldap/bulk-import/{resource} # Import entries from CSV file
349
- ```
350
-
351
- **Parameters for POST**:
352
-
353
- - `file` (multipart): CSV file to import
354
- - `dryRun` (optional): Validate without creating (true/false)
355
- - `updateExisting` (optional): Update existing entries (true/false)
356
- - `continueOnError` (optional): Continue on errors (true/false, default: true)
357
-
358
- ### Static Files
359
-
360
- Provided by `static`:
361
-
362
- ```
363
- GET /static/* # Serve static files
364
- GET /static/schemas/*.json # Serve schemas (with config replacement)
365
- ```
366
-
367
- ## Command-Line Tools
368
-
369
- ### cleanup-external-users
370
-
371
- Remove orphaned external contacts:
372
-
373
- ```bash
374
- # Preview deletions
375
- cleanup-external-users --dry-run
376
-
377
- # Delete with verbose output
378
- cleanup-external-users --verbose
379
-
380
- # Delete silently (for cron)
381
- cleanup-external-users --quiet
382
-
383
- # Show help
384
- cleanup-external-users --help
385
- ```
386
-
387
- See also: [ldapExternalUsersInGroups.md](ldapExternalUsersInGroups.md)
388
-
389
- ## Hooks System
390
-
391
- Plugins can register hooks to intercept and modify operations:
392
-
393
- ### Common Hooks
394
-
395
- - `ldap{Entity}add` - Before adding entry
396
- - `ldap{Entity}adddone` - After adding entry
397
- - `ldap{Entity}modify` - Before modifying entry
398
- - `ldap{Entity}modifydone` - After modifying entry
399
- - `ldap{Entity}delete` - Before deleting entry
400
- - `ldap{Entity}deletedone` - After deleting entry
401
- - `onLdapChange` - Any LDAP change
402
- - `onLdapMailChange` - Mail attribute changed
403
- - `onLdapQuotaChange` - Quota attribute changed
404
- - `ldapsearchrequest` - Before LDAP search
405
- - `getOrganisationTop` - Before returning organization tree top
406
-
407
- See individual plugin documentation for specific hooks.
408
-
409
- ## Development
410
-
411
- ### Creating Custom Plugins
412
-
413
- 1. Extend `DmPlugin` base class
414
- 2. Define plugin name and dependencies
415
- 3. Implement `api()` method for REST endpoints
416
- 4. Register hooks for LDAP operations
417
- 5. Load plugin via `--plugin path/to/plugin`
418
-
419
- Example:
420
-
421
- ```typescript
422
- import DmPlugin from '../abstract/plugin';
423
- import type { Express } from 'express';
424
- import type { Hooks } from '../hooks';
425
-
426
- export default class MyPlugin extends DmPlugin {
427
- name = 'myPlugin';
428
-
429
- dependencies = {
430
- onChange: 'core/ldap/onChange',
431
- };
432
-
433
- api(app: Express): void {
434
- app.get('/api/v1/my-endpoint', async (req, res) => {
435
- res.json({ message: 'Hello from MyPlugin' });
436
- });
437
- }
438
-
439
- hooks: Hooks = {
440
- onLdapChange: async (dn, changes) => {
441
- this.logger.info(`LDAP change detected: ${dn}`);
442
- },
443
- };
444
- }
445
- ```
446
-
447
- ### Plugin Priorities
448
-
449
- Some plugins must load before others. See `src/plugins/priority.json`:
450
-
451
- ```json
452
- [
453
- "core/auth/token",
454
- "core/auth/llng",
455
- "core/auth/openidconnect",
456
- "core/auth/authzPerBranch"
457
- ]
458
- ```
459
-
460
- Authentication plugins load first to secure API endpoints.
461
-
462
- ## Troubleshooting
463
-
464
- ### Common Issues
465
-
466
- 1. **Plugin not found**: Check plugin name matches exactly
467
- 2. **LDAP connection failed**: Verify URL, DN, and password
468
- 3. **Schema validation failed**: Check schema syntax and required fields
469
- 4. **404 on API**: Ensure plugin providing endpoint is loaded
470
- 5. **Permission denied**: Check authentication and authorization config
471
-
472
- ### Debug Mode
473
-
474
- Enable detailed logging:
475
-
476
- ```bash
477
- ldap-rest --log-level debug ...
478
- ```
479
-
480
- Available log levels (following syslog convention):
481
-
482
- - `error` - Only errors
483
- - `warn` - Warnings and errors
484
- - `notice` - Web access logs, warnings and errors (recommended for production)
485
- - `info` - General info messages, web logs, warnings and errors
486
- - `debug` - All messages including debug output
487
-
488
- ### Testing
489
-
490
- Run test suite:
491
-
492
- ```bash
493
- # All tests
494
- source ~/.test-env && npm run test:dev
33
+ ## Presentations
495
34
 
496
- # Single test file
497
- source ~/.test-env && npm run test:one test/path/to/file.test.ts
498
- ```
35
+ Interactive presentations (using [presenterm](https://github.com/mfontanini/presenterm)):
499
36
 
500
- See `DEVELOPMENT.md` for more testing information.
37
+ - **[English](presentations/en.md)** - `presenterm docs/presentations/en.md`
38
+ - **[French](presentations/fr.md)** - `presenterm docs/presentations/fr.md`
501
39
 
502
40
  ## Support
503
41
 
504
42
  - **Issues**: https://github.com/linagora/ldap-rest/issues
505
43
  - **Documentation**: https://github.com/linagora/ldap-rest/tree/master/docs
506
- - **Examples**: See `DEVELOPMENT.md` and plugin documentation
507
44
 
508
45
  ## License
509
46