ldap-rest 0.0.1

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 (296) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +48 -0
  3. package/bin/cleanup-external-users.mjs +219 -0
  4. package/bin/index.mjs +54 -0
  5. package/bin/sync-james.mjs +190 -0
  6. package/dist/abstract/ldapFlat.js +1 -0
  7. package/dist/abstract/plugin.js +1 -0
  8. package/dist/abstract/twakePlugin.js +1 -0
  9. package/dist/bin/index.js +1 -0
  10. package/dist/config/args.js +1 -0
  11. package/dist/lib/auth/base.js +1 -0
  12. package/dist/lib/authz/base.js +1 -0
  13. package/dist/lib/expressFormatedResponses.js +1 -0
  14. package/dist/lib/ldapActions.js +1 -0
  15. package/dist/lib/parseConfig.js +1 -0
  16. package/dist/lib/utils.js +1 -0
  17. package/dist/logger/winston.js +1 -0
  18. package/dist/plugins/auth/authzLinid1.js +1 -0
  19. package/dist/plugins/auth/authzPerBranch.js +1 -0
  20. package/dist/plugins/auth/crowdsec.js +1 -0
  21. package/dist/plugins/auth/llng.js +1 -0
  22. package/dist/plugins/auth/openidconnect.js +1 -0
  23. package/dist/plugins/auth/rateLimit.js +1 -0
  24. package/dist/plugins/auth/token.js +1 -0
  25. package/dist/plugins/configApi.js +1 -0
  26. package/dist/plugins/demo/helloworld.js +1 -0
  27. package/dist/plugins/ldap/bulkImport.js +1 -0
  28. package/dist/plugins/ldap/departmentSync.js +1 -0
  29. package/dist/plugins/ldap/externalUsersInGroups.js +1 -0
  30. package/dist/plugins/ldap/flatGeneric.js +1 -0
  31. package/dist/plugins/ldap/groups.js +1 -0
  32. package/dist/plugins/ldap/onChange.js +1 -0
  33. package/dist/plugins/ldap/organization.js +1 -0
  34. package/dist/plugins/ldap/trash.js +1 -0
  35. package/dist/plugins/priority.json.js +1 -0
  36. package/dist/plugins/static.js +1 -0
  37. package/dist/plugins/twake/calendarResources.js +1 -0
  38. package/dist/plugins/twake/james.js +1 -0
  39. package/dist/plugins/weblogs.js +1 -0
  40. package/dist/src/abstract/ldapFlat.d.ts +94 -0
  41. package/dist/src/abstract/plugin.d.ts +43 -0
  42. package/dist/src/abstract/twakePlugin.d.ts +90 -0
  43. package/dist/src/bin/index.d.ts +43 -0
  44. package/dist/src/browser/ldap-group-editor/LdapGroupEditor.d.ts +31 -0
  45. package/dist/src/browser/ldap-group-editor/api/GroupApiClient.d.ts +23 -0
  46. package/dist/src/browser/ldap-group-editor/components/CreateGroupModal.d.ts +19 -0
  47. package/dist/src/browser/ldap-group-editor/components/GroupPropertyEditor.d.ts +30 -0
  48. package/dist/src/browser/ldap-group-editor/components/GroupTree.d.ts +17 -0
  49. package/dist/src/browser/ldap-group-editor/components/MoveGroupModal.d.ts +20 -0
  50. package/dist/src/browser/ldap-group-editor/index.d.ts +6 -0
  51. package/dist/src/browser/ldap-group-editor/types.d.ts +58 -0
  52. package/dist/src/browser/ldap-resource-editor/api/ResourceApiClient.d.ts +53 -0
  53. package/dist/src/browser/ldap-resource-editor/cache/CacheManager.d.ts +65 -0
  54. package/dist/src/browser/ldap-resource-editor/index.d.ts +6 -0
  55. package/dist/src/browser/ldap-resource-editor/types.d.ts +78 -0
  56. package/dist/src/browser/ldap-tree-viewer/LdapTreeViewer.d.ts +26 -0
  57. package/dist/src/browser/ldap-tree-viewer/api/LdapApiClient.d.ts +30 -0
  58. package/dist/src/browser/ldap-tree-viewer/components/TreeNode.d.ts +17 -0
  59. package/dist/src/browser/ldap-tree-viewer/components/TreeRoot.d.ts +14 -0
  60. package/dist/src/browser/ldap-tree-viewer/index.d.ts +7 -0
  61. package/dist/src/browser/ldap-tree-viewer/store/Store.d.ts +18 -0
  62. package/dist/src/browser/ldap-tree-viewer/store/actions.d.ts +28 -0
  63. package/dist/src/browser/ldap-tree-viewer/store/reducers.d.ts +7 -0
  64. package/dist/src/browser/ldap-tree-viewer/types.d.ts +34 -0
  65. package/dist/src/browser/ldap-unit-editor/LdapUnitEditor.d.ts +27 -0
  66. package/dist/src/browser/ldap-unit-editor/api/UnitApiClient.d.ts +24 -0
  67. package/dist/src/browser/ldap-unit-editor/components/MoveUnitModal.d.ts +28 -0
  68. package/dist/src/browser/ldap-unit-editor/components/UnitPropertyEditor.d.ts +28 -0
  69. package/dist/src/browser/ldap-unit-editor/components/UnitTree.d.ts +18 -0
  70. package/dist/src/browser/ldap-unit-editor/index.d.ts +6 -0
  71. package/dist/src/browser/ldap-unit-editor/types.d.ts +55 -0
  72. package/dist/src/browser/ldap-user-editor/LdapUserEditor.d.ts +32 -0
  73. package/dist/src/browser/ldap-user-editor/api/UserApiClient.d.ts +55 -0
  74. package/dist/src/browser/ldap-user-editor/cache/CacheManager.d.ts +65 -0
  75. package/dist/src/browser/ldap-user-editor/components/MoveUserModal.d.ts +28 -0
  76. package/dist/src/browser/ldap-user-editor/components/PointerField.d.ts +22 -0
  77. package/dist/src/browser/ldap-user-editor/components/UserEditor.d.ts +46 -0
  78. package/dist/src/browser/ldap-user-editor/components/UserList.d.ts +24 -0
  79. package/dist/src/browser/ldap-user-editor/components/UserTree.d.ts +24 -0
  80. package/dist/src/browser/ldap-user-editor/index.d.ts +7 -0
  81. package/dist/src/browser/ldap-user-editor/types.d.ts +67 -0
  82. package/dist/src/browser/shared/components/Modal.d.ts +38 -0
  83. package/dist/src/browser/shared/components/StatusMessage.d.ts +48 -0
  84. package/dist/src/browser/shared/index.d.ts +10 -0
  85. package/dist/src/browser/shared/types/index.d.ts +65 -0
  86. package/dist/src/browser/shared/utils/dom.d.ts +33 -0
  87. package/dist/src/browser/shared/utils/form.d.ts +28 -0
  88. package/dist/src/browser/shared/utils/schema.d.ts +29 -0
  89. package/dist/src/config/args.d.ts +128 -0
  90. package/dist/src/config/schema.d.ts +18 -0
  91. package/dist/src/hooks.d.ts +76 -0
  92. package/dist/src/lib/auth/base.d.ts +9 -0
  93. package/dist/src/lib/authz/base.d.ts +63 -0
  94. package/dist/src/lib/expressFormatedResponses.d.ts +26 -0
  95. package/dist/src/lib/ldapActions.d.ts +91 -0
  96. package/dist/src/lib/parseConfig.d.ts +23 -0
  97. package/dist/src/lib/utils.d.ts +73 -0
  98. package/dist/src/logger/winston.d.ts +3 -0
  99. package/dist/src/plugins/auth/authzLinid1.d.ts +46 -0
  100. package/dist/src/plugins/auth/authzPerBranch.d.ts +59 -0
  101. package/dist/src/plugins/auth/crowdsec.d.ts +29 -0
  102. package/dist/src/plugins/auth/llng.d.ts +8 -0
  103. package/dist/src/plugins/auth/openidconnect.d.ts +11 -0
  104. package/dist/src/plugins/auth/rateLimit.d.ts +24 -0
  105. package/dist/src/plugins/auth/token.d.ts +17 -0
  106. package/dist/src/plugins/configApi.d.ts +24 -0
  107. package/dist/src/plugins/demo/helloworld.d.ts +12 -0
  108. package/dist/src/plugins/ldap/bulkImport.d.ts +48 -0
  109. package/dist/src/plugins/ldap/departmentSync.d.ts +35 -0
  110. package/dist/src/plugins/ldap/externalUsersInGroups.d.ts +21 -0
  111. package/dist/src/plugins/ldap/flatGeneric.d.ts +31 -0
  112. package/dist/src/plugins/ldap/groups.d.ts +95 -0
  113. package/dist/src/plugins/ldap/onChange.d.ts +32 -0
  114. package/dist/src/plugins/ldap/organization.d.ts +65 -0
  115. package/dist/src/plugins/ldap/trash.d.ts +52 -0
  116. package/dist/src/plugins/static.d.ts +7 -0
  117. package/dist/src/plugins/twake/calendarResources.d.ts +31 -0
  118. package/dist/src/plugins/twake/james.d.ts +83 -0
  119. package/dist/src/plugins/weblogs.d.ts +8 -0
  120. package/docs/DEVELOPER_GUIDE.md +298 -0
  121. package/docs/OPENAPI.md +440 -0
  122. package/docs/PLUGIN_DEPENDENCIES.md +612 -0
  123. package/docs/README.md +466 -0
  124. package/docs/api/REFERENCE.md +983 -0
  125. package/docs/api/REST_API.md +1237 -0
  126. package/docs/authentication.md +469 -0
  127. package/docs/authzLinid1.md +521 -0
  128. package/docs/authzPerBranch.md +596 -0
  129. package/docs/browser/LIBRARIES.md +1196 -0
  130. package/docs/examples/EXAMPLES.md +1659 -0
  131. package/docs/examples/twake-mailbox-type-nomenclature.ldif +37 -0
  132. package/docs/examples/twake-mailbox-type-schema-amendment.ldif +30 -0
  133. package/docs/jamesTeamMailboxes.md +343 -0
  134. package/docs/ldapBulkImport.md +722 -0
  135. package/docs/ldapExternalUsersInGroups.md +325 -0
  136. package/docs/ldapFlatGeneric.md +444 -0
  137. package/docs/ldapGroups.md +589 -0
  138. package/docs/ldapOrganizations.md +659 -0
  139. package/docs/ldapTrash.md +260 -0
  140. package/docs/linagora.png +0 -0
  141. package/docs/onChange.md +318 -0
  142. package/docs/plugins/DEVELOPMENT.md +1219 -0
  143. package/docs/presenterm-fr.md +721 -0
  144. package/docs/presenterm.md +721 -0
  145. package/docs/schemas/SCHEMAS.md +1212 -0
  146. package/docs/static.md +410 -0
  147. package/docs/twakeCalendarResources.md +148 -0
  148. package/docs/twakeJames.md +661 -0
  149. package/docs/weblogs.md +399 -0
  150. package/examples/web/ldap-group-editor.html +113 -0
  151. package/examples/web/ldap-tree-viewer.html +368 -0
  152. package/examples/web/ldap-unit-editor.html +108 -0
  153. package/examples/web/ldap-user-editor.html +412 -0
  154. package/package.json +458 -0
  155. package/static/browser/common-demo.css +450 -0
  156. package/static/browser/ldap-group-editor/LdapGroupEditor.js +207 -0
  157. package/static/browser/ldap-group-editor/LdapGroupEditor.js.map +1 -0
  158. package/static/browser/ldap-group-editor/api/GroupApiClient.js +112 -0
  159. package/static/browser/ldap-group-editor/api/GroupApiClient.js.map +1 -0
  160. package/static/browser/ldap-group-editor/components/CreateGroupModal.js +212 -0
  161. package/static/browser/ldap-group-editor/components/CreateGroupModal.js.map +1 -0
  162. package/static/browser/ldap-group-editor/components/GroupPropertyEditor.js +497 -0
  163. package/static/browser/ldap-group-editor/components/GroupPropertyEditor.js.map +1 -0
  164. package/static/browser/ldap-group-editor/components/GroupTree.js +153 -0
  165. package/static/browser/ldap-group-editor/components/GroupTree.js.map +1 -0
  166. package/static/browser/ldap-group-editor/components/MoveGroupModal.js +235 -0
  167. package/static/browser/ldap-group-editor/components/MoveGroupModal.js.map +1 -0
  168. package/static/browser/ldap-group-editor/index.js +2 -0
  169. package/static/browser/ldap-group-editor/index.js.map +1 -0
  170. package/static/browser/ldap-group-editor/types.js +2 -0
  171. package/static/browser/ldap-group-editor/types.js.map +1 -0
  172. package/static/browser/ldap-group-editor.esm.js +1399 -0
  173. package/static/browser/ldap-group-editor.esm.js.map +1 -0
  174. package/static/browser/ldap-group-editor.js +1407 -0
  175. package/static/browser/ldap-group-editor.js.map +1 -0
  176. package/static/browser/ldap-group-editor.min.js +2 -0
  177. package/static/browser/ldap-group-editor.min.js.map +1 -0
  178. package/static/browser/ldap-resource-editor/api/ResourceApiClient.js +226 -0
  179. package/static/browser/ldap-resource-editor/api/ResourceApiClient.js.map +1 -0
  180. package/static/browser/ldap-resource-editor/cache/CacheManager.js +123 -0
  181. package/static/browser/ldap-resource-editor/cache/CacheManager.js.map +1 -0
  182. package/static/browser/ldap-resource-editor/index.js +2 -0
  183. package/static/browser/ldap-resource-editor/index.js.map +1 -0
  184. package/static/browser/ldap-resource-editor/types.js +2 -0
  185. package/static/browser/ldap-resource-editor/types.js.map +1 -0
  186. package/static/browser/ldap-tree-viewer/LdapTreeViewer.js +187 -0
  187. package/static/browser/ldap-tree-viewer/LdapTreeViewer.js.map +1 -0
  188. package/static/browser/ldap-tree-viewer/api/LdapApiClient.js +50 -0
  189. package/static/browser/ldap-tree-viewer/api/LdapApiClient.js.map +1 -0
  190. package/static/browser/ldap-tree-viewer/components/TreeNode.js +140 -0
  191. package/static/browser/ldap-tree-viewer/components/TreeNode.js.map +1 -0
  192. package/static/browser/ldap-tree-viewer/components/TreeRoot.js +98 -0
  193. package/static/browser/ldap-tree-viewer/components/TreeRoot.js.map +1 -0
  194. package/static/browser/ldap-tree-viewer/index.js +2 -0
  195. package/static/browser/ldap-tree-viewer/index.js.map +1 -0
  196. package/static/browser/ldap-tree-viewer/store/Store.js +29 -0
  197. package/static/browser/ldap-tree-viewer/store/Store.js.map +1 -0
  198. package/static/browser/ldap-tree-viewer/store/actions.js +53 -0
  199. package/static/browser/ldap-tree-viewer/store/actions.js.map +1 -0
  200. package/static/browser/ldap-tree-viewer/store/reducers.js +79 -0
  201. package/static/browser/ldap-tree-viewer/store/reducers.js.map +1 -0
  202. package/static/browser/ldap-tree-viewer/types.js +2 -0
  203. package/static/browser/ldap-tree-viewer/types.js.map +1 -0
  204. package/static/browser/ldap-tree-viewer.css +2 -0
  205. package/static/browser/ldap-tree-viewer.css.map +1 -0
  206. package/static/browser/ldap-tree-viewer.esm.js +606 -0
  207. package/static/browser/ldap-tree-viewer.esm.js.map +1 -0
  208. package/static/browser/ldap-tree-viewer.js +614 -0
  209. package/static/browser/ldap-tree-viewer.js.map +1 -0
  210. package/static/browser/ldap-tree-viewer.min.js +2 -0
  211. package/static/browser/ldap-tree-viewer.min.js.map +1 -0
  212. package/static/browser/ldap-unit-editor/LdapUnitEditor.js +119 -0
  213. package/static/browser/ldap-unit-editor/LdapUnitEditor.js.map +1 -0
  214. package/static/browser/ldap-unit-editor/api/UnitApiClient.js +95 -0
  215. package/static/browser/ldap-unit-editor/api/UnitApiClient.js.map +1 -0
  216. package/static/browser/ldap-unit-editor/components/MoveUnitModal.js +295 -0
  217. package/static/browser/ldap-unit-editor/components/MoveUnitModal.js.map +1 -0
  218. package/static/browser/ldap-unit-editor/components/UnitPropertyEditor.js +321 -0
  219. package/static/browser/ldap-unit-editor/components/UnitPropertyEditor.js.map +1 -0
  220. package/static/browser/ldap-unit-editor/components/UnitTree.js +197 -0
  221. package/static/browser/ldap-unit-editor/components/UnitTree.js.map +1 -0
  222. package/static/browser/ldap-unit-editor/index.js +2 -0
  223. package/static/browser/ldap-unit-editor/index.js.map +1 -0
  224. package/static/browser/ldap-unit-editor/types.js +2 -0
  225. package/static/browser/ldap-unit-editor/types.js.map +1 -0
  226. package/static/browser/ldap-unit-editor.esm.js +1013 -0
  227. package/static/browser/ldap-unit-editor.esm.js.map +1 -0
  228. package/static/browser/ldap-unit-editor.js +1021 -0
  229. package/static/browser/ldap-unit-editor.js.map +1 -0
  230. package/static/browser/ldap-unit-editor.min.js +2 -0
  231. package/static/browser/ldap-unit-editor.min.js.map +1 -0
  232. package/static/browser/ldap-user-editor/LdapUserEditor.js +184 -0
  233. package/static/browser/ldap-user-editor/LdapUserEditor.js.map +1 -0
  234. package/static/browser/ldap-user-editor/api/UserApiClient.js +209 -0
  235. package/static/browser/ldap-user-editor/api/UserApiClient.js.map +1 -0
  236. package/static/browser/ldap-user-editor/cache/CacheManager.js +123 -0
  237. package/static/browser/ldap-user-editor/cache/CacheManager.js.map +1 -0
  238. package/static/browser/ldap-user-editor/components/MoveUserModal.js +302 -0
  239. package/static/browser/ldap-user-editor/components/MoveUserModal.js.map +1 -0
  240. package/static/browser/ldap-user-editor/components/PointerField.js +152 -0
  241. package/static/browser/ldap-user-editor/components/PointerField.js.map +1 -0
  242. package/static/browser/ldap-user-editor/components/UserEditor.js +608 -0
  243. package/static/browser/ldap-user-editor/components/UserEditor.js.map +1 -0
  244. package/static/browser/ldap-user-editor/components/UserList.js +181 -0
  245. package/static/browser/ldap-user-editor/components/UserList.js.map +1 -0
  246. package/static/browser/ldap-user-editor/components/UserTree.js +164 -0
  247. package/static/browser/ldap-user-editor/components/UserTree.js.map +1 -0
  248. package/static/browser/ldap-user-editor/index.js +2 -0
  249. package/static/browser/ldap-user-editor/index.js.map +1 -0
  250. package/static/browser/ldap-user-editor/types.js +2 -0
  251. package/static/browser/ldap-user-editor/types.js.map +1 -0
  252. package/static/browser/ldap-user-editor.css +2 -0
  253. package/static/browser/ldap-user-editor.css.map +1 -0
  254. package/static/browser/ldap-user-editor.esm.js +1897 -0
  255. package/static/browser/ldap-user-editor.esm.js.map +1 -0
  256. package/static/browser/ldap-user-editor.js +1905 -0
  257. package/static/browser/ldap-user-editor.js.map +1 -0
  258. package/static/browser/ldap-user-editor.min.js +2 -0
  259. package/static/browser/ldap-user-editor.min.js.map +1 -0
  260. package/static/browser/shared/components/Modal.js +121 -0
  261. package/static/browser/shared/components/Modal.js.map +1 -0
  262. package/static/browser/shared/components/StatusMessage.js +119 -0
  263. package/static/browser/shared/components/StatusMessage.js.map +1 -0
  264. package/static/browser/shared/index.js +7 -0
  265. package/static/browser/shared/index.js.map +1 -0
  266. package/static/browser/shared/types/index.js +37 -0
  267. package/static/browser/shared/types/index.js.map +1 -0
  268. package/static/browser/shared/utils/dom.js +78 -0
  269. package/static/browser/shared/utils/dom.js.map +1 -0
  270. package/static/browser/shared/utils/form.js +234 -0
  271. package/static/browser/shared/utils/form.js.map +1 -0
  272. package/static/browser/shared/utils/schema.js +121 -0
  273. package/static/browser/shared/utils/schema.js.map +1 -0
  274. package/static/browser/shared.esm.js +694 -0
  275. package/static/browser/shared.esm.js.map +1 -0
  276. package/static/browser/shared.js +723 -0
  277. package/static/browser/shared.js.map +1 -0
  278. package/static/browser/shared.min.js +2 -0
  279. package/static/browser/shared.min.js.map +1 -0
  280. package/static/schemas/ad/computers.json +92 -0
  281. package/static/schemas/ad/groups.json +55 -0
  282. package/static/schemas/ad/organizations.json +66 -0
  283. package/static/schemas/ad/users.json +116 -0
  284. package/static/schemas/standard/devices.json +72 -0
  285. package/static/schemas/standard/groups.json +54 -0
  286. package/static/schemas/standard/organizations.json +49 -0
  287. package/static/schemas/standard/users.json +86 -0
  288. package/static/schemas/twake/groups.json +75 -0
  289. package/static/schemas/twake/nomenclature/twakeAccountStatus.json +31 -0
  290. package/static/schemas/twake/nomenclature/twakeDeliveryMode.json +31 -0
  291. package/static/schemas/twake/nomenclature/twakeListType.json +31 -0
  292. package/static/schemas/twake/nomenclature/twakeMailboxType.json +31 -0
  293. package/static/schemas/twake/nomenclature/twakeTitle.json +31 -0
  294. package/static/schemas/twake/organizations.json +52 -0
  295. package/static/schemas/twake/positions.json +32 -0
  296. package/static/schemas/twake/users.json +112 -0
@@ -0,0 +1,612 @@
1
+ # Plugin Dependency Graph
2
+
3
+ This document describes the dependencies between LDAP-Rest plugins. There are two types of dependencies:
4
+
5
+ 1. **Explicit Dependencies**: Defined in the `dependencies` property of a plugin class
6
+ 2. **Hook Dependencies**: Implicit dependencies through hooks (one plugin provides a hook, another consumes it)
7
+
8
+ ## Dependency Types
9
+
10
+ ### Explicit Dependencies
11
+
12
+ These are declared in the plugin's `dependencies` property and are required for the plugin to function.
13
+
14
+ ```typescript
15
+ dependencies = {
16
+ ldapGroups: 'core/ldap/ldapGroups',
17
+ onLdapChange: 'core/ldap/onChange',
18
+ };
19
+ ```
20
+
21
+ ### Hook Dependencies
22
+
23
+ **Hook Providers**: Plugins that implement hooks (via `hooks: Hooks = { ... }`)
24
+ **Hook Consumers**: Plugins that call hooks (via `runHook()` or `launchHooks()`)
25
+
26
+ ## Complete Dependency Graph
27
+
28
+ ### Authentication Plugins
29
+
30
+ #### `authToken` (core/auth/token)
31
+
32
+ - **Dependencies**: None
33
+ - **Provides Hooks**: None
34
+ - **Consumes Hooks**: None
35
+ - **Notes**: Standalone authentication plugin
36
+
37
+ #### `authLemonldapNg` (core/auth/llng)
38
+
39
+ - **Dependencies**: None
40
+ - **Provides Hooks**: None
41
+ - **Consumes Hooks**: None
42
+ - **Notes**: LemonLDAP::NG SSO integration
43
+
44
+ #### `openidconnect` (core/auth/openidconnect)
45
+
46
+ - **Dependencies**: None
47
+ - **Provides Hooks**: None
48
+ - **Consumes Hooks**: `beforeAuth`, `afterAuth`
49
+ - **Notes**: OAuth2/OIDC authentication
50
+
51
+ #### `crowdsec` (core/auth/crowdsec)
52
+
53
+ - **Dependencies**: None
54
+ - **Provides Hooks**: None
55
+ - **Consumes Hooks**: None
56
+ - **Notes**: IP blocking via CrowdSec (must be loaded before auth plugins)
57
+
58
+ #### `rateLimit` (core/auth/rateLimit)
59
+
60
+ - **Dependencies**: None
61
+ - **Provides Hooks**: None
62
+ - **Consumes Hooks**: None
63
+ - **Notes**: Rate limiting (must be loaded before auth plugins)
64
+
65
+ #### `authzPerBranch` (core/auth/authzPerBranch)
66
+
67
+ - **Dependencies**: None (requires any auth plugin to be loaded first)
68
+ - **Provides Hooks**: Authorization hooks via `AuthzBase`
69
+ - **Consumes Hooks**: None
70
+ - **Notes**: Branch-level authorization
71
+
72
+ #### `authzLinid1` (core/auth/authzLinid1)
73
+
74
+ - **Dependencies**: None (requires any auth plugin to be loaded first)
75
+ - **Provides Hooks**: Authorization hooks via `AuthzBase`
76
+ - **Consumes Hooks**: None
77
+ - **Notes**: LinID 1.x authorization integration
78
+
79
+ ### LDAP Core Plugins
80
+
81
+ #### `onLdapChange` (core/ldap/onChange)
82
+
83
+ - **Dependencies**: None
84
+ - **Provides Hooks**:
85
+ - `ldapmodifyrequest` - Before LDAP modify
86
+ - `ldapmodifydone` - After LDAP modify
87
+ - **Consumes Hooks**: (Fires these hooks for other plugins to consume)
88
+ - `onLdapChange` - Any LDAP change
89
+ - `onLdapMailChange` - Mail attribute changed
90
+ - `onLdapQuotaChange` - Quota attribute changed
91
+ - `onLdapForwardChange` - Forward attribute changed
92
+ - `onLdapAliasChange` - Alias attribute changed
93
+ - `onLdapDisplayNameChange` - Display name changed
94
+ - **Notes**: Core plugin for change detection and notification
95
+
96
+ #### `ldapFlatGeneric` (core/ldap/flatGeneric)
97
+
98
+ - **Dependencies**:
99
+ - `departmentSync: 'core/ldap/departmentSync'` (optional)
100
+ - **Provides Hooks**: Dynamic hooks based on entity type (e.g., `ldap{Entity}add`, `ldap{Entity}modify`, etc.)
101
+ - **Consumes Hooks**: Entity-specific hooks
102
+ - **Notes**: Creates multiple plugin instances based on schemas
103
+
104
+ #### `ldapGroups` (core/ldap/groups)
105
+
106
+ - **Dependencies**: None
107
+ - **Provides Hooks**:
108
+ - `ldapdeleterequest` - Before LDAP delete (checks group membership)
109
+ - **Consumes Hooks**:
110
+ - `ldapgroupadd` - Before adding group
111
+ - `ldapgroupadddone` - After adding group
112
+ - `ldapgroupmodify` - Before modifying group
113
+ - `ldapgroupmodifydone` - After modifying group
114
+ - `ldapgrouprename` - Before renaming group
115
+ - `ldapgrouprenamedone` - After renaming group
116
+ - `ldapgroupdelete` - Before deleting group
117
+ - `ldapgroupdeletedone` - After deleting group
118
+ - `ldapgroupaddmember` - Before adding member
119
+ - `ldapgroupdeletemember` - Before deleting member
120
+ - `ldapgroupvalidatemembers` - Validate group members
121
+ - `_ldapgrouplist` - Filter group list
122
+ - `ldapgroupvalidatenew` - Validate new group
123
+ - `ldapgroupvalidatechanges` - Validate group changes
124
+ - **Notes**: Central group management plugin
125
+
126
+ #### `ldapOrganizations` (core/ldap/organization)
127
+
128
+ - **Dependencies**: None
129
+ - **Provides Hooks**:
130
+ - `ldapaddrequest` - Validates organization link/path on add
131
+ - `ldapmodifyrequest` - Validates organization link/path on modify
132
+ - `ldapdeleterequest` - Prevents deleting non-empty organizations
133
+ - `ldaprenamerequest` - Validates organization renames
134
+ - **Consumes Hooks**:
135
+ - `getOrganisationTop` - Filter top organization
136
+ - **Notes**: Hierarchical organization management
137
+
138
+ #### `ldapDepartmentSync` (core/ldap/departmentSync)
139
+
140
+ - **Dependencies**: None
141
+ - **Provides Hooks**:
142
+ - `ldaprenamedone` - After organization rename/move, updates all resources
143
+ - **Consumes Hooks**: None
144
+ - **Notes**: Synchronizes department links when organizations are renamed
145
+
146
+ #### `externalUsersInGroups` (core/ldap/externalUsersInGroups)
147
+
148
+ - **Dependencies**:
149
+ - `ldapGroups: 'core/ldap/ldapGroups'` ⚠️ **Required**
150
+ - **Provides Hooks**:
151
+ - `ldapgroupvalidatemembers` - Auto-creates external users
152
+ - **Consumes Hooks**:
153
+ - `externaluserentry` - Modify external user entry before creation
154
+ - `externaluseradded` - After external user is created
155
+ - **Notes**: Auto-creates external contacts when added to groups
156
+
157
+ #### `trash` (core/ldap/trash)
158
+
159
+ - **Dependencies**: None
160
+ - **Provides Hooks**:
161
+ - `ldapdeleterequest` - Intercepts deletes and moves to trash
162
+ - **Consumes Hooks**: None
163
+ - **Notes**: Soft delete system
164
+
165
+ #### `ldapBulkImport` (core/ldap/bulkImport)
166
+
167
+ - **Dependencies**: None
168
+ - **Provides Hooks**: None
169
+ - **Consumes Hooks**: None
170
+ - **Notes**: CSV-based bulk import (uses schema-driven configuration)
171
+
172
+ ### Twake Integration Plugins
173
+
174
+ #### `james` (twake/james)
175
+
176
+ - **Dependencies**:
177
+ - `onLdapChange: 'core/ldap/onChange'` ⚠️ **Required**
178
+ - `ldapGroups: 'core/ldap/groups'` ⚠️ **Required**
179
+ - **Provides Hooks**:
180
+ - `ldapadddone` - After user added
181
+ - `onLdapMailChange` - Syncs mailbox on mail change
182
+ - `onLdapAliasChange` - Syncs aliases
183
+ - `onLdapQuotaChange` - Syncs quota
184
+ - `onLdapForwardChange` - Syncs forwarding
185
+ - `onLdapChange` - General LDAP change handling
186
+ - `onLdapDisplayNameChange` - Syncs display name
187
+ - `ldapgroupadddone` - After group added
188
+ - `ldapgroupmodifydone` - After group modified
189
+ - `ldapgroupdeletedone` - After group deleted
190
+ - **Consumes Hooks**: (Hooks provided by `onLdapChange`)
191
+ - **Notes**: Synchronizes LDAP users/groups with Apache James mail server
192
+
193
+ #### `calendarResources` (twake/calendarResources)
194
+
195
+ - **Dependencies**: None
196
+ - **Provides Hooks**:
197
+ - `ldapcalendarResourceadddone` - After calendar resource added
198
+ - `ldapcalendarResourcemodifydone` - After calendar resource modified
199
+ - `ldapcalendarResourcedeletedone` - After calendar resource deleted
200
+ - **Consumes Hooks**: None
201
+ - **Notes**: Synchronizes calendar resources with Twake Calendar
202
+
203
+ ### Utility Plugins
204
+
205
+ #### `static` (core/static)
206
+
207
+ - **Dependencies**: None
208
+ - **Provides Hooks**: None
209
+ - **Consumes Hooks**: None
210
+ - **Notes**: Serves static files and JSON schemas
211
+
212
+ #### `weblogs` (core/weblogs)
213
+
214
+ - **Dependencies**: None
215
+ - **Provides Hooks**: None
216
+ - **Consumes Hooks**: None
217
+ - **Notes**: HTTP request logging
218
+
219
+ #### `configApi` (core/configApi)
220
+
221
+ - **Dependencies**: None (reads configuration from other loaded plugins)
222
+ - **Provides Hooks**: None
223
+ - **Consumes Hooks**: None
224
+ - **Notes**: Exposes API configuration for frontend applications
225
+
226
+ ### Demo Plugins
227
+
228
+ #### `hello` (demo/helloworld)
229
+
230
+ - **Dependencies**: None
231
+ - **Provides Hooks**: None
232
+ - **Consumes Hooks**: `hello` (demonstrates hook system)
233
+ - **Notes**: Example plugin for development/testing
234
+
235
+ ## Dependency Chains
236
+
237
+ ### Mail Server Integration Chain
238
+
239
+ ```
240
+ james (twake/james)
241
+ ├─→ requires: onLdapChange (core/ldap/onChange)
242
+ │ └─→ provides: ldapmodifyrequest, ldapmodifydone
243
+ │ └─→ fires: onLdapMailChange, onLdapQuotaChange, etc.
244
+ └─→ requires: ldapGroups (core/ldap/groups)
245
+ └─→ provides: ldapdeleterequest
246
+ └─→ consumes: ldapgroup* hooks
247
+ ```
248
+
249
+ ### External Users Chain
250
+
251
+ ```
252
+ externalUsersInGroups (core/ldap/externalUsersInGroups)
253
+ └─→ requires: ldapGroups (core/ldap/ldapGroups)
254
+ └─→ provides: ldapgroupvalidatemembers hook
255
+ └─→ consumes: externaluserentry, externaluseradded hooks
256
+ ```
257
+
258
+ ### Organization Sync Chain
259
+
260
+ ```
261
+ ldapFlatGeneric (core/ldap/flatGeneric)
262
+ └─→ optionally uses: departmentSync (core/ldap/departmentSync)
263
+ └─→ provides: ldaprenamedone hook
264
+ └─→ updates resources when organizations are renamed
265
+ ```
266
+
267
+ ### Delete Interception Chain
268
+
269
+ ```
270
+ trash (core/ldap/trash)
271
+ └─→ provides: ldapdeleterequest hook
272
+ └─→ intercepts deletes, moves to trash instead
273
+
274
+ ldapGroups (core/ldap/groups)
275
+ └─→ provides: ldapdeleterequest hook
276
+ └─→ checks group membership before delete
277
+
278
+ ldapOrganizations (core/ldap/organization)
279
+ └─→ provides: ldapdeleterequest hook
280
+ └─→ prevents deleting non-empty organizations
281
+ ```
282
+
283
+ **Note**: Multiple plugins can provide the same hook. Hooks are executed as chains, allowing multiple plugins to participate in the same operation.
284
+
285
+ ## Visual Dependency Graph
286
+
287
+ ### ASCII Dependency Graph
288
+
289
+ ```
290
+ ┌─────────────────────────────────────────────────────────────────────────────┐
291
+ │ AUTHENTICATION LAYER │
292
+ ├─────────────────────────────────────────────────────────────────────────────┤
293
+ │ │
294
+ │ ┌──────────┐ ┌──────────┐ ┌──────────────┐ ┌─────────────┐ │
295
+ │ │crowdsec │ │rateLimit │ │authToken │ │authLLNG │ │
296
+ │ │ │ │ │ │ │ │ │ │
297
+ │ └──────────┘ └──────────┘ └──────────────┘ └─────────────┘ │
298
+ │ │
299
+ │ ┌──────────────┐ ┌─────────────┐ ┌─────────────┐ │
300
+ │ │openidconnect │ │authzPerBranch│ │authzLinid1 │ │
301
+ │ │ │ │ │ │ │ │
302
+ │ └──────────────┘ └─────────────┘ └─────────────┘ │
303
+ │ │
304
+ └─────────────────────────────────────────────────────────────────────────────┘
305
+ │
306
+ ▼
307
+ ┌─────────────────────────────────────────────────────────────────────────────┐
308
+ │ LDAP CORE LAYER │
309
+ ├─────────────────────────────────────────────────────────────────────────────┤
310
+ │ │
311
+ │ ┌────────────────┐ ┌──────────────┐ ┌───────────────┐ │
312
+ │ │ onChange │ │ groups │ │organizations │ │
313
+ │ │ (change │ │ (group │ │ (org tree) │ │
314
+ │ │ detection) │ │ management) │ │ │ │
315
+ │ └────────────────┘ └──────────────┘ └───────────────┘ │
316
+ │ │ │ │ │
317
+ │ │ │ │ │
318
+ │ │ ┌─────┴──────┐ │ │
319
+ │ │ │ │ │ │
320
+ │ │ ┌──────────▼───────┐ │ │ │
321
+ │ │ │externalUsers │ │ │ │
322
+ │ │ │InGroups │ │ │ │
323
+ │ │ │(auto-create) │ │ │ │
324
+ │ │ └──────────────────┘ │ │ │
325
+ │ │ │ │ │
326
+ │ │ ┌──────▼──────────┐ │ │
327
+ │ ┌──────▼────────┐ │ flatGeneric │◄──────┘ │
328
+ │ │departmentSync │◄───────────────│ (entity mgmt) │ │
329
+ │ │(org rename) │ (optional) │ │ │
330
+ │ └───────────────┘ └─────────────────┘ │
331
+ │ │
332
+ │ ┌──────────┐ ┌──────────────┐ │
333
+ │ │ trash │ │ bulkImport │ │
334
+ │ │(soft del)│ │ (CSV import)│ │
335
+ │ └──────────┘ └──────────────┘ │
336
+ │ │
337
+ └─────────────────────────────────────────────────────────────────────────────┘
338
+ │
339
+ ▼
340
+ ┌─────────────────────────────────────────────────────────────────────────────┐
341
+ │ INTEGRATION LAYER │
342
+ ├─────────────────────────────────────────────────────────────────────────────┤
343
+ │ │
344
+ │ ┌────────────────────────────┐ ┌──────────────────────────┐ │
345
+ │ │ james │ │ calendarResources │ │
346
+ │ │ (Apache James sync) │ │ (Twake Calendar sync) │ │
347
+ │ │ │ │ │ │
348
+ │ │ Requires: │ │ │ │
349
+ │ │ • onChange ─────────────┼──┐ │ │ │
350
+ │ │ • groups ───────────────┼──┘ │ │ │
351
+ │ └────────────────────────────┘ └──────────────────────────┘ │
352
+ │ │
353
+ └─────────────────────────────────────────────────────────────────────────────┘
354
+ │
355
+ ▼
356
+ ┌─────────────────────────────────────────────────────────────────────────────┐
357
+ │ UTILITY LAYER │
358
+ ├─────────────────────────────────────────────────────────────────────────────┤
359
+ │ │
360
+ │ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
361
+ │ │ static │ │ weblogs │ │ configApi │ │
362
+ │ │(files) │ │(logging) │ │(config API) │ │
363
+ │ └──────────┘ └──────────┘ └──────────────┘ │
364
+ │ │
365
+ └─────────────────────────────────────────────────────────────────────────────┘
366
+
367
+
368
+ Legend:
369
+ ──► Explicit dependency (required)
370
+ ◄── Optional dependency
371
+ │ Hook relationship
372
+ ```
373
+
374
+ ### Detailed Dependency Connections
375
+
376
+ ```
377
+ ┌──────────────────────────────────────────────────────────────┐
378
+ │ EXPLICIT DEPENDENCIES (Plugin A requires Plugin B) │
379
+ └──────────────────────────────────────────────────────────────┘
380
+
381
+ james ──────► onChange (core/ldap/onChange)
382
+ ──────► groups (core/ldap/groups)
383
+
384
+ externalUsersInGroups ──────► groups (core/ldap/groups)
385
+
386
+ flatGeneric ─ ─ ─► departmentSync (optional)
387
+
388
+
389
+ ┌──────────────────────────────────────────────────────────────┐
390
+ │ HOOK DEPENDENCIES (Plugin A fires hooks, Plugin B consumes) │
391
+ └──────────────────────────────────────────────────────────────┘
392
+
393
+ onChange ─┬─ fires ──► onLdapChange ────────► james
394
+ ├─ fires ──► onLdapMailChange ────► james
395
+ ├─ fires ──► onLdapQuotaChange ───► james
396
+ ├─ fires ──► onLdapAliasChange ───► james
397
+ ├─ fires ──► onLdapForwardChange ─► james
398
+ └─ fires ──► onLdapDisplayNameChange ─► james
399
+
400
+ groups ───── fires ──► ldapgroupvalidatemembers ──► externalUsersInGroups
401
+
402
+ departmentSync ── fires ──► ldaprenamedone ──► flatGeneric instances
403
+
404
+
405
+ ┌──────────────────────────────────────────────────────────────┐
406
+ │ HOOK PROVIDERS (Plugins that intercept LDAP operations) │
407
+ └──────────────────────────────────────────────────────────────┘
408
+
409
+ LDAP Delete Request Chain (multiple plugins):
410
+ trash ──► ldapdeleterequest (moves to trash)
411
+ groups ──► ldapdeleterequest (checks members)
412
+ organizations ──► ldapdeleterequest (checks empty)
413
+
414
+ LDAP Modify Request Chain:
415
+ onChange ──► ldapmodifyrequest (detects changes)
416
+ organizations ──► ldapmodifyrequest (validates org links)
417
+
418
+ LDAP Add Request Chain:
419
+ organizations ──► ldapaddrequest (validates org links)
420
+
421
+ LDAP Rename Request Chain:
422
+ organizations ──► ldaprenamerequest (validates renames)
423
+ ```
424
+
425
+ ### Mermaid Diagram (for GitHub/viewers)
426
+
427
+ ```mermaid
428
+ graph TB
429
+ %% Authentication plugins
430
+ authToken[authToken]
431
+ authLLNG[authLemonldapNg]
432
+ openidconnect[openidconnect]
433
+ crowdsec[crowdsec]
434
+ rateLimit[rateLimit]
435
+ authzPerBranch[authzPerBranch]
436
+ authzLinid1[authzLinid1]
437
+
438
+ %% LDAP Core
439
+ onChange[onLdapChange]
440
+ flatGeneric[ldapFlatGeneric]
441
+ groups[ldapGroups]
442
+ organizations[ldapOrganizations]
443
+ departmentSync[ldapDepartmentSync]
444
+ externalUsers[externalUsersInGroups]
445
+ trash[trash]
446
+ bulkImport[ldapBulkImport]
447
+
448
+ %% Twake Integration
449
+ james[james]
450
+ calendar[calendarResources]
451
+
452
+ %% Utility
453
+ static[static]
454
+ weblogs[weblogs]
455
+ configApi[configApi]
456
+
457
+ %% Explicit dependencies
458
+ james -->|requires| onChange
459
+ james -->|requires| groups
460
+ externalUsers -->|requires| groups
461
+ flatGeneric -.->|optionally uses| departmentSync
462
+
463
+ %% Hook dependencies (major ones)
464
+ onChange -.->|fires hooks| james
465
+ groups -.->|validates members| externalUsers
466
+
467
+ %% Styling
468
+ classDef auth fill:#e1f5ff,stroke:#0288d1
469
+ classDef ldap fill:#e8f5e9,stroke:#388e3c
470
+ classDef twake fill:#fff3e0,stroke:#f57c00
471
+ classDef util fill:#f3e5f5,stroke:#7b1fa2
472
+
473
+ class authToken,authLLNG,openidconnect,crowdsec,rateLimit,authzPerBranch,authzLinid1 auth
474
+ class onChange,flatGeneric,groups,organizations,departmentSync,externalUsers,trash,bulkImport ldap
475
+ class james,calendar twake
476
+ class static,weblogs,configApi util
477
+ ```
478
+
479
+ ## Loading Order Recommendations
480
+
481
+ ### 1. Security Plugins (must load first)
482
+
483
+ 1. `crowdsec` - IP blocking
484
+ 2. `rateLimit` - Rate limiting
485
+
486
+ ### 2. Authentication Plugins
487
+
488
+ 3. `authToken` OR `authLemonldapNg` OR `openidconnect`
489
+ 4. `authzPerBranch` OR `authzLinid1` (optional, after auth)
490
+
491
+ ### 3. LDAP Core Plugins
492
+
493
+ 5. `onChange` - Required by `james`
494
+ 6. `groups` - Required by `james` and `externalUsersInGroups`
495
+ 7. `organizations` - Organization management
496
+ 8. `departmentSync` - Before `flatGeneric` if using department sync
497
+ 9. `flatGeneric` - Entity management
498
+ 10. `externalUsersInGroups` - After `groups`
499
+ 11. `trash` - Soft delete (optional)
500
+ 12. `bulkImport` - Bulk import (optional)
501
+
502
+ ### 4. Integration Plugins
503
+
504
+ 13. `james` - After `onChange` and `groups`
505
+ 14. `calendarResources` - Calendar sync (optional)
506
+
507
+ ### 5. Utility Plugins (can load anytime)
508
+
509
+ - `static` - Static files
510
+ - `weblogs` - Logging
511
+ - `configApi` - Configuration API
512
+
513
+ ## Plugin Priority System
514
+
515
+ LDAP-Rest uses a priority system defined in `src/plugins/priority.json`:
516
+
517
+ ```json
518
+ [
519
+ "core/auth/crowdsec",
520
+ "core/auth/rateLimit",
521
+ "core/auth/token",
522
+ "core/auth/llng",
523
+ "core/auth/openidconnect",
524
+ "core/auth/authzPerBranch",
525
+ "core/auth/authzLinid1"
526
+ ]
527
+ ```
528
+
529
+ Plugins in this list load before others, ensuring security plugins run first.
530
+
531
+ ## Hook Execution Order
532
+
533
+ Hooks are executed in the order plugins are loaded. For chained hooks:
534
+
535
+ 1. First plugin in chain can modify/validate data
536
+ 2. Returns modified data to next plugin
537
+ 3. Last plugin's return value is used
538
+
539
+ For non-chained hooks:
540
+
541
+ - All hooks execute in parallel
542
+ - Order doesn't matter
543
+
544
+ **Example**: `ldapdeleterequest` chain
545
+
546
+ ```
547
+ Request → trash (moves to trash) → groups (checks members) → organizations (checks empty) → LDAP
548
+ ```
549
+
550
+ ## Creating Plugins with Dependencies
551
+
552
+ ### Explicit Dependencies
553
+
554
+ ```typescript
555
+ export default class MyPlugin extends DmPlugin {
556
+ name = 'myPlugin';
557
+
558
+ dependencies = {
559
+ ldapGroups: 'core/ldap/ldapGroups',
560
+ onChange: 'core/ldap/onChange',
561
+ };
562
+ }
563
+ ```
564
+
565
+ ### Consuming Hooks
566
+
567
+ ```typescript
568
+ export default class MyPlugin extends DmPlugin {
569
+ hooks: Hooks = {
570
+ onLdapMailChange: async ([dn, oldMail, newMail]) => {
571
+ // React to mail changes
572
+ console.log(`Mail changed from ${oldMail} to ${newMail}`);
573
+ },
574
+ };
575
+ }
576
+ ```
577
+
578
+ ### Providing Hooks
579
+
580
+ ```typescript
581
+ export default class MyPlugin extends DmPlugin {
582
+ async someMethod() {
583
+ // Fire a hook for other plugins to consume
584
+ await this.server.launchHooks('myCustomHook', [param1, param2]);
585
+ }
586
+ }
587
+ ```
588
+
589
+ ## Dependency Validation
590
+
591
+ LDAP-Rest validates dependencies at startup:
592
+
593
+ 1. Checks all `dependencies` properties
594
+ 2. Ensures required plugins are loaded
595
+ 3. Fails with error if dependencies missing
596
+ 4. Logs warning for optional dependencies
597
+
598
+ ## Best Practices
599
+
600
+ 1. **Declare explicit dependencies**: Use `dependencies` property for hard requirements
601
+ 2. **Document hook dependencies**: Comment which hooks your plugin consumes
602
+ 3. **Use optional dependencies carefully**: Check if plugin is loaded before using
603
+ 4. **Respect load order**: Security → Auth → LDAP → Integration → Utility
604
+ 5. **Test plugin isolation**: Ensure plugin works when optional dependencies are missing
605
+ 6. **Avoid circular dependencies**: Plugin A shouldn't require Plugin B if B requires A
606
+ 7. **Use hooks for loose coupling**: Prefer hooks over direct plugin references
607
+
608
+ ## See Also
609
+
610
+ - [Plugin Development Guide](DEVELOPER_GUIDE.md)
611
+ - [Hook System Documentation](../src/hooks/README.md)
612
+ - [Plugin Priority Configuration](../src/plugins/priority.json)