ldap-rest 1.2.1 → 2.0.0
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.
- package/bin/sync-james.mjs +13 -2
- package/dist/abstract/ldapFlat.js +1 -1
- package/dist/abstract/plugin.js +1 -1
- package/dist/abstract/twakePlugin.js +1 -1
- package/dist/bin/index.js +1 -1
- package/dist/config/args.js +1 -1
- package/dist/config/options.js +1 -0
- package/dist/config/schema.js +1 -1
- package/dist/lib/auth/base.js +1 -1
- package/dist/lib/authz/base.js +1 -1
- package/dist/lib/entitySchema/validator.js +1 -1
- package/dist/lib/errors.js +1 -1
- package/dist/lib/expressFormatedResponses.js +1 -1
- package/dist/lib/health.js +1 -1
- package/dist/lib/hookBus.js +1 -0
- package/dist/lib/instanceProviders.js +1 -1
- package/dist/lib/ldap/callerView.js +1 -0
- package/dist/lib/ldap/pool.js +1 -0
- package/dist/lib/ldap/schema.js +1 -0
- package/dist/lib/ldap/searchCache.js +1 -0
- package/dist/lib/ldapActions.js +1 -1
- package/dist/lib/ldapSchema.js +1 -1
- package/dist/lib/parseConfig.js +1 -1
- package/dist/lib/route.js +1 -0
- package/dist/lib/schemaFile.js +1 -1
- package/dist/lib/services/index.js +1 -0
- package/dist/lib/storage/store.js +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/version.js +1 -0
- package/dist/logger/winston.js +1 -1
- package/dist/plugins/auth/auth.options.js +1 -0
- package/dist/plugins/auth/authzDynamic.js +1 -1
- package/dist/plugins/auth/authzLinid1.js +1 -1
- package/dist/plugins/auth/authzPerBranch.js +1 -1
- package/dist/plugins/auth/authzPerRoute.js +1 -1
- package/dist/plugins/auth/authzScope.js +1 -1
- package/dist/plugins/auth/crowdsec.js +1 -1
- package/dist/plugins/auth/fake.js +1 -1
- package/dist/plugins/auth/hmac.js +1 -1
- package/dist/plugins/auth/llng.js +1 -1
- package/dist/plugins/auth/openidconnect.js +1 -1
- package/dist/plugins/auth/rateLimit.js +1 -1
- package/dist/plugins/auth/token.js +1 -1
- package/dist/plugins/auth/totp.js +1 -1
- package/dist/plugins/auth/trustedProxy.js +1 -1
- package/dist/plugins/bcl.js +1 -1
- package/dist/plugins/bcl.options.js +1 -0
- package/dist/plugins/configApi.js +1 -1
- package/dist/plugins/demo/helloworld.js +1 -1
- package/dist/plugins/ldap/accountLifecycle.js +1 -1
- package/dist/plugins/ldap/bulkImport.js +1 -1
- package/dist/plugins/ldap/departmentSync.js +1 -1
- package/dist/plugins/ldap/enterpriseRules.js +1 -1
- package/dist/plugins/ldap/externalUsersInGroups.js +1 -1
- package/dist/plugins/ldap/flatGeneric.js +1 -1
- package/dist/plugins/ldap/groups.js +1 -1
- package/dist/plugins/ldap/ldap.options.js +1 -0
- package/dist/plugins/ldap/onChange.js +1 -1
- package/dist/plugins/ldap/organizations.js +1 -1
- package/dist/plugins/ldap/passwordPolicy.js +1 -1
- package/dist/plugins/ldap/raw.js +1 -1
- package/dist/plugins/ldap/trash.js +1 -1
- package/dist/plugins/metrics.js +1 -1
- package/dist/plugins/metrics.options.js +1 -0
- package/dist/plugins/rabbitmq.js +1 -1
- package/dist/plugins/rabbitmq.options.js +1 -0
- package/dist/plugins/scim/baseResolver.js +1 -1
- package/dist/plugins/scim/bulk.js +1 -1
- package/dist/plugins/scim/discovery.js +1 -1
- package/dist/plugins/scim/errors.js +1 -1
- package/dist/plugins/scim/filter.js +1 -1
- package/dist/plugins/scim/groups.js +1 -1
- package/dist/plugins/scim/mapping.js +1 -1
- package/dist/plugins/scim/patch.js +1 -1
- package/dist/plugins/scim/scim.js +1 -1
- package/dist/plugins/scim/scim.options.js +1 -0
- package/dist/plugins/scim/users.js +1 -1
- package/dist/plugins/static.js +1 -1
- package/dist/plugins/static.options.js +1 -0
- package/dist/plugins/storage/file.js +1 -1
- package/dist/plugins/storage/ldap.js +1 -1
- package/dist/plugins/storage/postgres.js +1 -1
- package/dist/plugins/storage/valkey.js +1 -1
- package/dist/plugins/storage.js +1 -1
- package/dist/plugins/storage.options.js +1 -0
- package/dist/plugins/twake/appAccounts.options.js +1 -0
- package/dist/plugins/twake/appAccountsApi.js +1 -1
- package/dist/plugins/twake/appAccountsConsistency.js +1 -1
- package/dist/plugins/twake/calendar.js +1 -1
- package/dist/plugins/twake/calendar.options.js +1 -0
- package/dist/plugins/twake/calendarResources.js +1 -1
- package/dist/plugins/twake/cloudery.options.js +1 -0
- package/dist/plugins/twake/clouderyProvision.js +1 -1
- package/dist/plugins/twake/cozy.options.js +1 -0
- package/dist/plugins/twake/cozyProvision.js +1 -1
- package/dist/plugins/twake/drive.js +1 -1
- package/dist/plugins/twake/drive.options.js +1 -0
- package/dist/plugins/twake/groups.js +1 -1
- package/dist/plugins/twake/instances.js +1 -1
- package/dist/plugins/twake/james.js +1 -1
- package/dist/plugins/twake/james.options.js +1 -0
- package/dist/plugins/twake/lifecycleAttributes.js +1 -1
- package/dist/plugins/twake/lifecycleEvents.js +1 -1
- package/dist/plugins/twake/migrationProxy.js +1 -1
- package/dist/plugins/twake/migrationProxy.options.js +1 -0
- package/dist/plugins/twake/spaces.js +1 -1
- package/dist/plugins/twake/tombstone.js +1 -1
- package/dist/plugins/twake/twakeGroups.options.js +1 -0
- package/dist/plugins/twake/twakeInstances.options.js +1 -0
- package/dist/plugins/twake/twakeLifecycle.options.js +1 -0
- package/dist/plugins/twake/twakeSpaces.options.js +1 -0
- package/dist/plugins/twake/twakeTombstone.options.js +1 -0
- package/dist/plugins/weblogs.js +1 -1
- package/dist/src/abstract/ldapFlat.d.ts +41 -10
- package/dist/src/abstract/plugin.d.ts +31 -5
- package/dist/src/abstract/twakePlugin.d.ts +14 -4
- package/dist/src/bin/index.d.ts +35 -4
- package/dist/src/config/args.d.ts +2 -4
- package/dist/src/config/options.d.ts +104 -0
- package/dist/src/config/schema.d.ts +50 -1
- package/dist/src/hooks.d.ts +60 -22
- package/dist/src/lib/authz/base.d.ts +4 -51
- package/dist/src/lib/authz/composition.d.ts +2 -2
- package/dist/src/lib/entitySchema/validator.d.ts +63 -6
- package/dist/src/lib/errors.d.ts +57 -1
- package/dist/src/lib/expressFormatedResponses.d.ts +49 -7
- package/dist/src/lib/hookBus.d.ts +226 -0
- package/dist/src/lib/instanceProviders.d.ts +0 -8
- package/dist/src/lib/ldap/callerView.d.ts +45 -0
- package/dist/src/lib/ldap/pool.d.ts +108 -0
- package/dist/src/lib/ldap/schema.d.ts +157 -0
- package/dist/src/lib/ldap/searchCache.d.ts +112 -0
- package/dist/src/lib/ldapActions.d.ts +26 -256
- package/dist/src/lib/parseConfig.d.ts +31 -2
- package/dist/src/lib/route.d.ts +99 -0
- package/dist/src/lib/services/index.d.ts +56 -0
- package/dist/src/lib/utils.d.ts +100 -36
- package/dist/src/lib/version.d.ts +12 -0
- package/dist/src/plugins/auth/auth.options.d.ts +88 -0
- package/dist/src/plugins/auth/authzDynamic.d.ts +10 -1
- package/dist/src/plugins/auth/authzLinid1.d.ts +6 -0
- package/dist/src/plugins/auth/authzPerBranch.d.ts +9 -0
- package/dist/src/plugins/auth/authzPerRoute.d.ts +3 -0
- package/dist/src/plugins/auth/authzScope.d.ts +23 -14
- package/dist/src/plugins/auth/crowdsec.d.ts +5 -0
- package/dist/src/plugins/auth/fake.d.ts +3 -0
- package/dist/src/plugins/auth/hmac.d.ts +4 -0
- package/dist/src/plugins/auth/llng.d.ts +4 -0
- package/dist/src/plugins/auth/openidconnect.d.ts +7 -0
- package/dist/src/plugins/auth/rateLimit.d.ts +4 -0
- package/dist/src/plugins/auth/token.d.ts +3 -0
- package/dist/src/plugins/auth/totp.d.ts +5 -0
- package/dist/src/plugins/auth/trustedProxy.d.ts +4 -0
- package/dist/src/plugins/bcl.d.ts +3 -0
- package/dist/src/plugins/bcl.options.d.ts +8 -0
- package/dist/src/plugins/configApi.d.ts +24 -5
- package/dist/src/plugins/demo/helloworld.d.ts +8 -19
- package/dist/src/plugins/ldap/accountLifecycle.d.ts +17 -0
- package/dist/src/plugins/ldap/bulkImport.d.ts +6 -76
- package/dist/src/plugins/ldap/departmentSync.d.ts +1 -0
- package/dist/src/plugins/ldap/enterpriseRules.d.ts +8 -15
- package/dist/src/plugins/ldap/externalUsersInGroups.d.ts +4 -0
- package/dist/src/plugins/ldap/flatGeneric.d.ts +4 -0
- package/dist/src/plugins/ldap/groups.d.ts +27 -11
- package/dist/src/plugins/ldap/ldap.options.d.ts +75 -0
- package/dist/src/plugins/ldap/onChange.d.ts +10 -2
- package/dist/src/plugins/ldap/organizations.d.ts +16 -0
- package/dist/src/plugins/ldap/passwordPolicy.d.ts +35 -3
- package/dist/src/plugins/ldap/raw.d.ts +50 -19
- package/dist/src/plugins/ldap/trash.d.ts +6 -0
- package/dist/src/plugins/metrics.d.ts +3 -0
- package/dist/src/plugins/metrics.options.d.ts +8 -0
- package/dist/src/plugins/rabbitmq.d.ts +3 -0
- package/dist/src/plugins/rabbitmq.options.d.ts +8 -0
- package/dist/src/plugins/scim/baseResolver.d.ts +2 -1
- package/dist/src/plugins/scim/bulk.d.ts +6 -7
- package/dist/src/plugins/scim/discovery.d.ts +3 -0
- package/dist/src/plugins/scim/errors.d.ts +2 -1
- package/dist/src/plugins/scim/groups.d.ts +6 -4
- package/dist/src/plugins/scim/mapping.d.ts +16 -3
- package/dist/src/plugins/scim/scim.d.ts +37 -3
- package/dist/src/plugins/scim/scim.options.d.ts +35 -0
- package/dist/src/plugins/scim/types.d.ts +2 -0
- package/dist/src/plugins/scim/users.d.ts +6 -7
- package/dist/src/plugins/static.d.ts +9 -0
- package/dist/src/plugins/static.options.d.ts +13 -0
- package/dist/src/plugins/storage.d.ts +12 -1
- package/dist/src/plugins/storage.options.d.ts +16 -0
- package/dist/src/plugins/twake/appAccounts.options.d.ts +13 -0
- package/dist/src/plugins/twake/appAccountsApi.d.ts +18 -0
- package/dist/src/plugins/twake/appAccountsConsistency.d.ts +8 -0
- package/dist/src/plugins/twake/calendar.d.ts +25 -2
- package/dist/src/plugins/twake/calendar.options.d.ts +19 -0
- package/dist/src/plugins/twake/cloudery.options.d.ts +26 -0
- package/dist/src/plugins/twake/clouderyProvision.d.ts +18 -0
- package/dist/src/plugins/twake/cozy.options.d.ts +23 -0
- package/dist/src/plugins/twake/cozyProvision.d.ts +14 -0
- package/dist/src/plugins/twake/drive.d.ts +7 -0
- package/dist/src/plugins/twake/drive.options.d.ts +15 -0
- package/dist/src/plugins/twake/groups.d.ts +29 -1
- package/dist/src/plugins/twake/instances.d.ts +74 -10
- package/dist/src/plugins/twake/james.d.ts +17 -0
- package/dist/src/plugins/twake/james.options.d.ts +21 -0
- package/dist/src/plugins/twake/lifecycleAttributes.d.ts +13 -2
- package/dist/src/plugins/twake/lifecycleEvents.d.ts +12 -0
- package/dist/src/plugins/twake/migrationProxy.d.ts +11 -11
- package/dist/src/plugins/twake/migrationProxy.options.d.ts +16 -0
- package/dist/src/plugins/twake/spaces.d.ts +30 -0
- package/dist/src/plugins/twake/tombstone.d.ts +25 -16
- package/dist/src/plugins/twake/twakeGroups.options.d.ts +20 -0
- package/dist/src/plugins/twake/twakeInstances.options.d.ts +43 -0
- package/dist/src/plugins/twake/twakeLifecycle.options.d.ts +21 -0
- package/dist/src/plugins/twake/twakeSpaces.options.d.ts +19 -0
- package/dist/src/plugins/twake/twakeTombstone.options.d.ts +17 -0
- package/docs/README.md +17 -2
- package/docs/client-development/api/rest-api.md +13 -3
- package/docs/client-development/schemas/README.md +96 -32
- package/docs/development/contracts.md +109 -0
- package/docs/plugin-development/README.md +53 -95
- package/docs/plugin-development/dependencies.md +24 -8
- package/docs/plugin-development/hooks.md +143 -23
- package/docs/plugin-development/openapi.md +14 -1
- package/docs/plugin-development/options.md +136 -0
- package/docs/plugin-development/routes.md +152 -0
- package/docs/plugin-development/services.md +95 -0
- package/docs/plugin-development/testing.md +3 -3
- package/docs/usage/configuration.md +18 -11
- package/docs/usage/operations.md +28 -4
- package/docs/usage/plugins/integrations/instances.md +11 -3
- package/docs/usage/plugins/integrations/lifecycle-events.md +4 -1
- package/docs/usage/plugins/integrations/scim.md +20 -18
- package/docs/usage/plugins/integrations/tombstone.md +10 -6
- package/docs/usage/plugins/ldap/enterprise-rules.md +10 -1
- package/docs/usage/plugins/ldap/flat-generic.md +11 -0
- package/docs/usage/plugins/ldap/groups.md +4 -1
- package/docs/usage/plugins/ldap/password-policy.md +7 -0
- package/docs/usage/plugins/ldap/raw.md +17 -1
- package/docs/usage/upgrading.md +253 -0
- package/package.json +372 -286
- package/static/browser/ldap-browser/LdapBrowser.js +8 -6
- package/static/browser/ldap-browser/LdapBrowser.js.map +1 -1
- package/static/browser/ldap-browser/api/RawApiClient.js +2 -0
- package/static/browser/ldap-browser/api/RawApiClient.js.map +1 -1
- package/static/browser/ldap-browser/components/EntryTree.js +9 -5
- package/static/browser/ldap-browser/components/EntryTree.js.map +1 -1
- package/static/browser/ldap-browser/components/EntryView.js +2 -0
- package/static/browser/ldap-browser/components/EntryView.js.map +1 -1
- package/static/browser/ldap-browser/schema.js +3 -2
- package/static/browser/ldap-browser/schema.js.map +1 -1
- package/static/browser/ldap-browser.esm.js +27 -18
- package/static/browser/ldap-browser.esm.js.map +1 -1
- package/static/browser/ldap-browser.js +27 -18
- package/static/browser/ldap-browser.js.map +1 -1
- package/static/browser/ldap-browser.min.js +1 -1
- package/static/browser/ldap-browser.min.js.map +1 -1
- package/static/browser/ldap-group-editor/LdapGroupEditor.js +8 -6
- package/static/browser/ldap-group-editor/LdapGroupEditor.js.map +1 -1
- package/static/browser/ldap-group-editor/api/GroupApiClient.js +1 -0
- package/static/browser/ldap-group-editor/api/GroupApiClient.js.map +1 -1
- package/static/browser/ldap-group-editor/components/CreateGroupModal.js +5 -1
- package/static/browser/ldap-group-editor/components/CreateGroupModal.js.map +1 -1
- package/static/browser/ldap-group-editor/components/GroupPropertyEditor.js +6 -3
- package/static/browser/ldap-group-editor/components/GroupPropertyEditor.js.map +1 -1
- package/static/browser/ldap-group-editor/components/GroupTree.js +6 -3
- package/static/browser/ldap-group-editor/components/GroupTree.js.map +1 -1
- package/static/browser/ldap-group-editor/components/MoveGroupModal.js +6 -3
- package/static/browser/ldap-group-editor/components/MoveGroupModal.js.map +1 -1
- package/static/browser/ldap-group-editor.esm.js +32 -16
- package/static/browser/ldap-group-editor.esm.js.map +1 -1
- package/static/browser/ldap-group-editor.js +32 -16
- package/static/browser/ldap-group-editor.js.map +1 -1
- package/static/browser/ldap-group-editor.min.js +1 -1
- package/static/browser/ldap-group-editor.min.js.map +1 -1
- package/static/browser/ldap-resource-editor/api/ResourceApiClient.js +3 -0
- package/static/browser/ldap-resource-editor/api/ResourceApiClient.js.map +1 -1
- package/static/browser/ldap-resource-editor/cache/CacheManager.js +3 -1
- package/static/browser/ldap-resource-editor/cache/CacheManager.js.map +1 -1
- package/static/browser/ldap-tree-viewer/LdapTreeViewer.js +6 -1
- package/static/browser/ldap-tree-viewer/LdapTreeViewer.js.map +1 -1
- package/static/browser/ldap-tree-viewer/api/LdapApiClient.js +2 -0
- package/static/browser/ldap-tree-viewer/api/LdapApiClient.js.map +1 -1
- package/static/browser/ldap-tree-viewer/components/TreeNode.js +4 -0
- package/static/browser/ldap-tree-viewer/components/TreeNode.js.map +1 -1
- package/static/browser/ldap-tree-viewer/components/TreeRoot.js +3 -0
- package/static/browser/ldap-tree-viewer/components/TreeRoot.js.map +1 -1
- package/static/browser/ldap-tree-viewer/store/Store.js +3 -1
- package/static/browser/ldap-tree-viewer/store/Store.js.map +1 -1
- package/static/browser/ldap-tree-viewer.esm.js +18 -2
- package/static/browser/ldap-tree-viewer.esm.js.map +1 -1
- package/static/browser/ldap-tree-viewer.js +18 -2
- package/static/browser/ldap-tree-viewer.js.map +1 -1
- package/static/browser/ldap-tree-viewer.min.js +1 -1
- package/static/browser/ldap-tree-viewer.min.js.map +1 -1
- package/static/browser/ldap-unit-editor/LdapUnitEditor.js +7 -5
- package/static/browser/ldap-unit-editor/LdapUnitEditor.js.map +1 -1
- package/static/browser/ldap-unit-editor/api/UnitApiClient.js +1 -0
- package/static/browser/ldap-unit-editor/api/UnitApiClient.js.map +1 -1
- package/static/browser/ldap-unit-editor/components/MoveUnitModal.js +7 -4
- package/static/browser/ldap-unit-editor/components/MoveUnitModal.js.map +1 -1
- package/static/browser/ldap-unit-editor/components/UnitPropertyEditor.js +7 -4
- package/static/browser/ldap-unit-editor/components/UnitPropertyEditor.js.map +1 -1
- package/static/browser/ldap-unit-editor/components/UnitTree.js +6 -3
- package/static/browser/ldap-unit-editor/components/UnitTree.js.map +1 -1
- package/static/browser/ldap-unit-editor.esm.js +28 -16
- package/static/browser/ldap-unit-editor.esm.js.map +1 -1
- package/static/browser/ldap-unit-editor.js +28 -16
- package/static/browser/ldap-unit-editor.js.map +1 -1
- package/static/browser/ldap-unit-editor.min.js +1 -1
- package/static/browser/ldap-unit-editor.min.js.map +1 -1
- package/static/browser/ldap-user-editor/LdapUserEditor.js +9 -7
- package/static/browser/ldap-user-editor/LdapUserEditor.js.map +1 -1
- package/static/browser/ldap-user-editor/api/UserApiClient.js +2 -0
- package/static/browser/ldap-user-editor/api/UserApiClient.js.map +1 -1
- package/static/browser/ldap-user-editor/cache/CacheManager.js +3 -1
- package/static/browser/ldap-user-editor/cache/CacheManager.js.map +1 -1
- package/static/browser/ldap-user-editor/components/MoveUserModal.js +7 -4
- package/static/browser/ldap-user-editor/components/MoveUserModal.js.map +1 -1
- package/static/browser/ldap-user-editor/components/PointerField.js +6 -1
- package/static/browser/ldap-user-editor/components/PointerField.js.map +1 -1
- package/static/browser/ldap-user-editor/components/UserEditor.js +10 -5
- package/static/browser/ldap-user-editor/components/UserEditor.js.map +1 -1
- package/static/browser/ldap-user-editor/components/UserList.js +8 -4
- package/static/browser/ldap-user-editor/components/UserList.js.map +1 -1
- package/static/browser/ldap-user-editor/components/UserTree.js +7 -3
- package/static/browser/ldap-user-editor/components/UserTree.js.map +1 -1
- package/static/browser/ldap-user-editor.esm.js +55 -30
- package/static/browser/ldap-user-editor.esm.js.map +1 -1
- package/static/browser/ldap-user-editor.js +55 -30
- package/static/browser/ldap-user-editor.js.map +1 -1
- package/static/browser/ldap-user-editor.min.js +1 -1
- package/static/browser/ldap-user-editor.min.js.map +1 -1
- package/static/browser/shared/components/DisposableComponent.js +3 -5
- package/static/browser/shared/components/DisposableComponent.js.map +1 -1
- package/static/browser/shared/components/Modal.js +2 -1
- package/static/browser/shared/components/Modal.js.map +1 -1
- package/static/browser/shared/components/StatusMessage.js +3 -2
- package/static/browser/shared/components/StatusMessage.js.map +1 -1
- package/static/browser/shared/utils/form.js.map +1 -1
- package/static/browser/shared/utils/hmac.js +1 -0
- package/static/browser/shared/utils/hmac.js.map +1 -1
- package/static/browser/shared/utils/totp.js +1 -0
- package/static/browser/shared/utils/totp.js.map +1 -1
- package/static/browser/shared.esm.js +9 -8
- package/static/browser/shared.esm.js.map +1 -1
- package/static/browser/shared.js +9 -8
- package/static/browser/shared.js.map +1 -1
- package/static/browser/shared.min.js +1 -1
- package/static/browser/shared.min.js.map +1 -1
- package/static/schemas/ad/groups.json +1 -1
- package/static/schemas/ad/users.json +3 -3
- package/static/schemas/example/organizations.json +2 -2
- package/static/schemas/example/users.json +2 -2
- package/static/schemas/obm/users.json +2 -2
- package/static/schemas/standard/groups.json +1 -1
- package/static/schemas/standard/users.json +2 -2
- package/static/schemas/twake/groups.json +4 -4
- package/static/schemas/twake/teamMailboxes.json +3 -3
- package/static/schemas/twake/users.json +7 -7
package/dist/src/hooks.d.ts
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { Entry, SearchOptions, SearchResult } from 'ldapts';
|
|
6
6
|
import type { Request, Response } from 'express';
|
|
7
|
-
import type { ModifyRequest, AttributesList, AttributeValue } from './lib/ldapActions';
|
|
7
|
+
import type { ModifyRequest, AttributesList, AttributeValue, LdapList } from './lib/ldapActions';
|
|
8
8
|
import type { ChangesToNotify } from './plugins/ldap/onChange';
|
|
9
9
|
import type { ChangeContext } from './lib/changeContext';
|
|
10
|
+
import type { BulkResponse, ScimGroup, ScimUser } from './plugins/scim/types';
|
|
10
11
|
import * as utils from './lib/utils';
|
|
11
12
|
export type MaybePromise<T> = Promise<T> | T;
|
|
12
13
|
export type ChainedHook<T> = (arg: T) => MaybePromise<T>;
|
|
@@ -29,7 +30,6 @@ export interface OidcSessionClaims {
|
|
|
29
30
|
}
|
|
30
31
|
export type OidcLogoutToken = OidcSessionClaims;
|
|
31
32
|
export type VoidHook<T extends unknown[]> = (...args: T) => MaybePromise<void>;
|
|
32
|
-
export type OtherHook = Function;
|
|
33
33
|
export { utils };
|
|
34
34
|
/**
|
|
35
35
|
* All available hooks
|
|
@@ -56,11 +56,11 @@ export interface Hooks {
|
|
|
56
56
|
*/
|
|
57
57
|
ldapsearchfilter?: ChainedHook<[SearchResult, Request?, SearchOptions?]>;
|
|
58
58
|
ldapaddrequest?: ChainedHook<[string, AttributesList, Request?]>;
|
|
59
|
-
ldapadddone?: (
|
|
59
|
+
ldapadddone?: (dn: string, entry: AttributesList, context?: ChangeContext) => MaybePromise<void>;
|
|
60
60
|
/** See docs/plugin-development/hooks.md#ldapaddafter */
|
|
61
|
-
ldapaddafter?: (
|
|
61
|
+
ldapaddafter?: (dn: string, entry: AttributesList, context?: ChangeContext) => MaybePromise<void>;
|
|
62
62
|
ldapmodifyrequest?: ChainedHook<[string, ModifyRequest, number, Request?]>;
|
|
63
|
-
ldapmodifydone?: (
|
|
63
|
+
ldapmodifydone?: (dn: string, changes: ModifyRequest, op: number, context?: ChangeContext) => MaybePromise<void>;
|
|
64
64
|
/**
|
|
65
65
|
* Once a modify is over, whatever became of it, after its `ldapmodifydone`
|
|
66
66
|
* subscribers have returned; with the operation number
|
|
@@ -75,7 +75,7 @@ export interface Hooks {
|
|
|
75
75
|
*/
|
|
76
76
|
ldapdeleteend?: (op: number) => MaybePromise<void>;
|
|
77
77
|
ldaprenamerequest?: ChainedHook<[string, string, Request?]>;
|
|
78
|
-
ldaprenamedone?: (
|
|
78
|
+
ldaprenamedone?: (dn: string, newDn: string, context?: ChangeContext) => MaybePromise<void>;
|
|
79
79
|
/**
|
|
80
80
|
* Once a rename is over, whatever became of it, after its `ldaprenamedone`
|
|
81
81
|
* subscribers have returned; with the operation number its request and
|
|
@@ -122,14 +122,20 @@ export interface Hooks {
|
|
|
122
122
|
/** LdapGroups plugin */
|
|
123
123
|
ldapgroupvalidatemembers?: ChainedHook<[string, string[]]>;
|
|
124
124
|
ldapgroupadd?: ChainedHook<[string, AttributesList]>;
|
|
125
|
-
ldapgroupadddone?: (
|
|
125
|
+
ldapgroupadddone?: (dn: string, entry: AttributesList) => MaybePromise<void>;
|
|
126
126
|
ldapgroupmodify?: ChainedHook<[string, ModifyRequest, number]>;
|
|
127
|
-
ldapgroupmodifydone?: (
|
|
127
|
+
ldapgroupmodifydone?: (dn: string, changes: ModifyRequest, op: number) => MaybePromise<void>;
|
|
128
|
+
ldapgrouprename?: ChainedHook<[string, string]>;
|
|
129
|
+
ldapgrouprenamedone?: (dn: string, newDn: string) => MaybePromise<void>;
|
|
130
|
+
/** Before `ldapgroupadd`, to judge the group about to be created */
|
|
131
|
+
ldapgroupvalidatenew?: ChainedHook<[string, AttributesList]>;
|
|
132
|
+
/** Before `ldapgroupmodify`, to judge the changes about to be written */
|
|
133
|
+
ldapgroupvalidatechanges?: ChainedHook<[string, ModifyRequest]>;
|
|
128
134
|
ldapgroupdelete?: ChainedHook<string>;
|
|
129
135
|
ldapgroupdeletedone?: (dn: string) => MaybePromise<void>;
|
|
130
136
|
ldapgroupaddmember?: ChainedHook<[string, string[]]>;
|
|
131
|
-
ldapgroupdeletemember?: ChainedHook<[string, string
|
|
132
|
-
_ldapgrouplist?: ChainedHook<
|
|
137
|
+
ldapgroupdeletemember?: ChainedHook<[string, string]>;
|
|
138
|
+
_ldapgrouplist?: ChainedHook<LdapList>;
|
|
133
139
|
/**
|
|
134
140
|
* "onLdapChange"
|
|
135
141
|
*
|
|
@@ -150,22 +156,54 @@ export interface Hooks {
|
|
|
150
156
|
onLdapDriveQuotaChange?: (dn: string, oldDriveQuota: number | null, newDriveQuota: number | null) => MaybePromise<void>;
|
|
151
157
|
/** externalUsersInGroup */
|
|
152
158
|
externaluserentry?: ChainedHook<[string, AttributesList]>;
|
|
153
|
-
|
|
159
|
+
/** The external member was created, with its DN and the entry written */
|
|
160
|
+
externaluseradded?: (dn: string, entry: AttributesList) => MaybePromise<void>;
|
|
154
161
|
/**
|
|
155
|
-
* Generic flat resource
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* Note: After move, onLdapChange is triggered automatically by modifyEntry()
|
|
162
|
+
* Generic flat resource hooks, one set per `--ldap-flat-schema` entity,
|
|
163
|
+
* `ldapusermove` for one renamed user: `{hookPrefix}` followed by the
|
|
164
|
+
* suffix of the shared hook of the same kind, see {@link FlatHookPrefix}.
|
|
165
|
+
* An entity's `move` hook takes `[dn, targetOrgDn, request?]`, and a move
|
|
166
|
+
* is followed by `onLdapChange`, as a modify is.
|
|
161
167
|
*/
|
|
162
|
-
[K: string]: ChainedHook<unknown> | VoidHook<unknown[]> | OtherHook | undefined;
|
|
163
168
|
/** Common authentication hooks */
|
|
164
169
|
beforeAuth?: ChainedHook<[Request, Response]>;
|
|
165
170
|
afterAuth?: ChainedHook<[Request, Response]>;
|
|
166
171
|
/** Organization hooks */
|
|
167
|
-
getOrganisationTop?: ChainedHook<[
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
172
|
+
getOrganisationTop?: ChainedHook<[Request | undefined, AttributesList]>;
|
|
173
|
+
/**
|
|
174
|
+
* SCIM plugin hooks
|
|
175
|
+
*
|
|
176
|
+
* The `create` and `update` hooks are chained and can mutate the resource
|
|
177
|
+
* about to be written; the `done` ones are notified once it is written.
|
|
178
|
+
* `scimgroupcreate` gets the group's base beside the request, which is
|
|
179
|
+
* always there: a group is created through the API.
|
|
180
|
+
*/
|
|
181
|
+
scimusercreate?: ChainedHook<[ScimUser, Request?]>;
|
|
182
|
+
scimusercreatedone?: VoidHook<[ScimUser]>;
|
|
183
|
+
scimuserupdate?: ChainedHook<[string, ScimUser, Request?]>;
|
|
184
|
+
scimuserupdatedone?: VoidHook<[string, ScimUser]>;
|
|
185
|
+
scimuserdelete?: ChainedHook<[string, Request?]>;
|
|
186
|
+
scimuserdeletedone?: VoidHook<[string]>;
|
|
187
|
+
/** `[group, request, base]` */
|
|
188
|
+
scimgroupcreate?: ChainedHook<[ScimGroup, Request, string]>;
|
|
189
|
+
scimgroupcreatedone?: VoidHook<[ScimGroup]>;
|
|
190
|
+
scimgroupupdate?: ChainedHook<[string, ScimGroup, Request?]>;
|
|
191
|
+
scimgroupupdatedone?: VoidHook<[string, ScimGroup]>;
|
|
192
|
+
scimgroupdelete?: ChainedHook<[string, Request?]>;
|
|
193
|
+
scimgroupdeletedone?: VoidHook<[string]>;
|
|
194
|
+
scimbulkdone?: VoidHook<[BulkResponse]>;
|
|
195
|
+
/**
|
|
196
|
+
* A delete asked of an entry that is already a tombstone. Fired
|
|
197
|
+
* synchronously with the request that asked it: whoever replays deletions
|
|
198
|
+
* records it from there. `[dn, entry, context]`.
|
|
199
|
+
*/
|
|
200
|
+
twakedeletionreplay?: (dn: string, entry: AttributesList, context: ChangeContext) => MaybePromise<void>;
|
|
171
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* The prefix of a flat entity's hooks, as `abstract/ldapFlat.ts` builds it:
|
|
204
|
+
* `ldap${entity.name}`. They are `{prefix}add`, `{prefix}adddone` and so on,
|
|
205
|
+
* one convention each, as the shared hook of the same suffix declares it,
|
|
206
|
+
* plus `{prefix}move` before an entry is moved. A plugin watching one
|
|
207
|
+
* declares them beside its other hooks.
|
|
208
|
+
*/
|
|
209
|
+
export type FlatHookPrefix = `ldap${string}`;
|
|
@@ -10,8 +10,9 @@ import type { SearchOptions } from 'ldapts';
|
|
|
10
10
|
import DmPlugin, { type Role } from '../../abstract/plugin';
|
|
11
11
|
import type { DM } from '../../bin';
|
|
12
12
|
import type { BranchPermissions } from '../../config/args';
|
|
13
|
+
import type { Hooks } from '../../hooks';
|
|
13
14
|
import { type DmRequest } from '../auth/base';
|
|
14
|
-
import type {
|
|
15
|
+
import type { ModifyRequest } from '../ldapActions';
|
|
15
16
|
/**
|
|
16
17
|
* The rule of the most specific configured branch holding `target`.
|
|
17
18
|
*
|
|
@@ -311,7 +312,7 @@ export default abstract class AuthzBase extends DmPlugin {
|
|
|
311
312
|
*
|
|
312
313
|
* @param req the request being authorized, which carries an identity
|
|
313
314
|
* @returns the resolved user, or null when the policy is to allow it
|
|
314
|
-
* @throws
|
|
315
|
+
* @throws AuthzRefusedError when the policy is to deny it
|
|
315
316
|
*/
|
|
316
317
|
/** Said once: a rule keyed on a value the authenticator did not publish. */
|
|
317
318
|
private fallbackWarned;
|
|
@@ -382,53 +383,5 @@ export default abstract class AuthzBase extends DmPlugin {
|
|
|
382
383
|
/**
|
|
383
384
|
* Common hooks for all authorization plugins
|
|
384
385
|
*/
|
|
385
|
-
hooks:
|
|
386
|
-
/**
|
|
387
|
-
* A rename moves the entry an identity resolves to, so what was
|
|
388
|
-
* resolved is dropped.
|
|
389
|
-
*
|
|
390
|
-
* `authzLinid1` keys its permissions on the administrator's DN: renamed
|
|
391
|
-
* or moved, they resolve to a DN no organization names any more, and
|
|
392
|
-
* every operation of theirs is refused until the TTL runs out. The
|
|
393
|
-
* whole map goes rather than one key, since what is cached is
|
|
394
|
-
* identity → DN and the hook carries DNs: a handful of lookups is
|
|
395
|
-
* cheaper than working out which identity moved.
|
|
396
|
-
*/
|
|
397
|
-
ldaprenamedone: () => void;
|
|
398
|
-
/**
|
|
399
|
-
* A delete removes the entry an identity resolves to, exactly as a
|
|
400
|
-
* rename moves it, so what was resolved is dropped the same way.
|
|
401
|
-
*
|
|
402
|
-
* An administrator deleted through the API is, for `authzLinid1`, still
|
|
403
|
-
* resolved to the former DN where the organization still names them:
|
|
404
|
-
* their session keeps its rights until the TTL runs out. Like the rename
|
|
405
|
-
* hook, the whole map goes rather than one key — the hook carries the
|
|
406
|
-
* deleted DN, and the cache keys identities, so a handful of lookups is
|
|
407
|
-
* cheaper than working out which identity the DN held.
|
|
408
|
-
*/
|
|
409
|
-
ldapdeletedone: () => void;
|
|
410
|
-
ldapmodifyrequest: ([dn, changes, opNumber, req]: [string, ModifyRequest, number, DmRequest?]) => Promise<[string, ModifyRequest, number, DmRequest?]>;
|
|
411
|
-
ldapaddrequest: ([dn, entry, req]: [string, AttributesList, DmRequest?]) => Promise<[string, AttributesList, DmRequest?]>;
|
|
412
|
-
ldapsearchrequest: ([base, opts, req]: [string, SearchOptions, DmRequest?]) => Promise<[string, SearchOptions, DmRequest?]>;
|
|
413
|
-
/**
|
|
414
|
-
* Drop what this caller may not read from a search it was granted.
|
|
415
|
-
*
|
|
416
|
-
* Judged by branch, the search was granted on its base: each entry is
|
|
417
|
-
* kept only where the caller may read it, a rule narrower than the base
|
|
418
|
-
* refusing part of what it holds. Judged by attachment, the accounts
|
|
419
|
-
* attached outside the branches this caller manages are dropped.
|
|
420
|
-
*
|
|
421
|
-
* Runs after the cache and carries the request, so what one caller may
|
|
422
|
-
* not see never reaches another. An entry with no organization link —
|
|
423
|
-
* an organization, a group, a nomenclature value — is left alone: those
|
|
424
|
-
* are the reference data every administrator reads.
|
|
425
|
-
*
|
|
426
|
-
* So is an entry attached to the transit branch: it is waiting for an
|
|
427
|
-
* administrator to claim it.
|
|
428
|
-
*/
|
|
429
|
-
ldapsearchfilter: ([result, req, opts]: [SearchResult, DmRequest?, SearchOptions?]) => Promise<[SearchResult, DmRequest?, SearchOptions?]>;
|
|
430
|
-
getOrganisationTop: ([req, defaultTop]: [DmRequest | undefined, AttributesList | null]) => Promise<[DmRequest | undefined, AttributesList | null]>;
|
|
431
|
-
ldaprenamerequest: ([oldDn, newDn, req]: [string, string, DmRequest?]) => Promise<[string, string, DmRequest?]>;
|
|
432
|
-
ldapdeleterequest: ([dn, req]: [string | string[], DmRequest?]) => Promise<[string | string[], DmRequest?]>;
|
|
433
|
-
};
|
|
386
|
+
hooks: Hooks;
|
|
434
387
|
}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* How authorization plugins loaded together compose, and the configurations
|
|
6
6
|
* where that composition is nobody's decision.
|
|
7
7
|
*
|
|
8
|
-
* Every plugin judging LDAP operations registers the same hooks, and
|
|
9
|
-
*
|
|
8
|
+
* Every plugin judging LDAP operations registers the same hooks, and the
|
|
9
|
+
* chain runs them all: two of them compose as an AND, the
|
|
10
10
|
* first refusal winning. That is a sound rule when it is meant. It is a
|
|
11
11
|
* refusal nobody can explain when it is not — `authzPerBranch` beside
|
|
12
12
|
* `authzDynamic` judges a machine token by a branch configuration written
|
|
@@ -22,19 +22,76 @@ export declare class EntityValidator {
|
|
|
22
22
|
private readonly deps;
|
|
23
23
|
constructor(schema: Schema | undefined, deps: EntityValidatorDeps);
|
|
24
24
|
/**
|
|
25
|
-
* Check a new entry, then convert it
|
|
25
|
+
* Check a new entry, then convert it for the directory. Every attribute
|
|
26
|
+
* the schema declares is named as the schema does, a form the defaults,
|
|
27
|
+
* the required check and the conversion all read.
|
|
26
28
|
*
|
|
27
29
|
* @param entry entry as the client sent it, `objectClass` included
|
|
30
|
+
* @returns the entry to write: the one given, or a copy under the schema's
|
|
31
|
+
* spellings
|
|
28
32
|
*/
|
|
29
|
-
validateNew(entry: AttributesList): Promise<
|
|
33
|
+
validateNew(entry: AttributesList): Promise<AttributesList>;
|
|
30
34
|
/**
|
|
31
|
-
* Check the parts of a change, then convert them
|
|
32
|
-
*
|
|
33
|
-
*
|
|
35
|
+
* Check the parts of a change, then convert them. Under a name the schema
|
|
36
|
+
* declares, no value becomes the empty list, which clears the attribute
|
|
37
|
+
* in a `replace` and is refused in an `add`; under a name it does not
|
|
38
|
+
* declare, a `null` is dropped from an `add` and becomes that empty list
|
|
39
|
+
* in a `replace`.
|
|
34
40
|
*
|
|
35
41
|
* @param changes change as the client sent it
|
|
42
|
+
* @returns the same change, under the schema's spellings
|
|
36
43
|
*/
|
|
37
|
-
validateChanges(changes: ModifyRequest): Promise<
|
|
44
|
+
validateChanges(changes: ModifyRequest): Promise<ModifyRequest>;
|
|
45
|
+
/**
|
|
46
|
+
* Name every key the schema declares as the schema does, and refuse two
|
|
47
|
+
* keys naming one attribute. The conversion, the required check and the
|
|
48
|
+
* defaults look a declared attribute up by its own name: a field they
|
|
49
|
+
* would leave out is one the client sent under another case or with a
|
|
50
|
+
* `;binary` option.
|
|
51
|
+
*
|
|
52
|
+
* @returns the same attributes, renamed: the map itself when nothing
|
|
53
|
+
* changes, a copy renamed otherwise
|
|
54
|
+
* @throws BadRequestError when two keys name the same attribute
|
|
55
|
+
*/
|
|
56
|
+
private renameDeclared;
|
|
57
|
+
/**
|
|
58
|
+
* {@link renameDeclared} on a list of names, such as a `delete`.
|
|
59
|
+
*
|
|
60
|
+
* Two names of one attribute are refused as the routes refuse them: as
|
|
61
|
+
* the schema declares it, or as this server knows the attribute by its
|
|
62
|
+
* name, which makes `l;binary` and `L` one attribute.
|
|
63
|
+
*/
|
|
64
|
+
private renameDeclaredNames;
|
|
65
|
+
/**
|
|
66
|
+
* The attribute a name holds, case and option aside: the option is a
|
|
67
|
+
* transfer syntax, and `l;binary` is the `l` a plain `L` names.
|
|
68
|
+
*/
|
|
69
|
+
private attributeIdentity;
|
|
70
|
+
/**
|
|
71
|
+
* The schema's spelling of a declared attribute, with the `;binary`
|
|
72
|
+
* option, the only one a write takes, written as the directory writes it.
|
|
73
|
+
*/
|
|
74
|
+
private schemaSpelling;
|
|
75
|
+
/**
|
|
76
|
+
* Drop, in place, the keys a creation or an `add` carries with `null` or
|
|
77
|
+
* `undefined` under a name the schema does not declare. A declared
|
|
78
|
+
* attribute is left to the schema, which turns no value into the empty
|
|
79
|
+
* list, refused for a `required` one; an undeclared one has no such step,
|
|
80
|
+
* and without a schema none exists. The write would otherwise carry
|
|
81
|
+
* `[null]`, which ldapts cannot send.
|
|
82
|
+
*/
|
|
83
|
+
private dropUndeclaredEmpty;
|
|
84
|
+
/**
|
|
85
|
+
* Check every value of a creation or of a part of a change, then write the
|
|
86
|
+
* shape each one is stored in, in place: no value becomes the empty list,
|
|
87
|
+
* which clears the attribute in a `replace`. A value the schema does not
|
|
88
|
+
* declare is left as sent on a change, and on a creation as the directory
|
|
89
|
+
* layer takes it.
|
|
90
|
+
*
|
|
91
|
+
* @param values entry of a creation, or `add` / `replace` of a change
|
|
92
|
+
* @param part the part of a change, undefined for a creation
|
|
93
|
+
*/
|
|
94
|
+
private checkValues;
|
|
38
95
|
/**
|
|
39
96
|
* Check one value against its attribute's rules: its shape, then the
|
|
40
97
|
* entries a pointer names, then the pattern.
|
package/dist/src/lib/errors.d.ts
CHANGED
|
@@ -59,6 +59,62 @@ export declare const errorBody: (err: unknown, message: string) => {
|
|
|
59
59
|
export declare class ForbiddenError extends HttpError {
|
|
60
60
|
constructor(message?: string);
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* An authorization plugin's refusal.
|
|
64
|
+
*
|
|
65
|
+
* Its message is for the operator, not for the client: it names the model
|
|
66
|
+
* and the branch it judged, which the caller may not know of. Its class is
|
|
67
|
+
* what says an authorization plugin refused, so the 403 is recognised
|
|
68
|
+
* through the `new Error(\`…\`, { cause })` wrappers along the way — see
|
|
69
|
+
* {@link isAuthzRefusal} — and the client is told {@link AUTHZ_REFUSED}.
|
|
70
|
+
*/
|
|
71
|
+
export declare class AuthzRefusedError extends ForbiddenError {
|
|
72
|
+
/**
|
|
73
|
+
* Read instead of the class and the name: a plugin loaded from `dist` holds
|
|
74
|
+
* another copy of this module, where `instanceof` answers false, and a
|
|
75
|
+
* subclass may replace `name`.
|
|
76
|
+
*/
|
|
77
|
+
readonly authzRefusal: true;
|
|
78
|
+
constructor(message: string);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Every error in a chain of `cause`s, the outermost first.
|
|
82
|
+
*
|
|
83
|
+
* A plugin wrapping what the directory or an authorization hook threw as
|
|
84
|
+
* `new Error(\`…\`, { cause: err })` keeps the reason and what it carries:
|
|
85
|
+
* its class, its status, the database's refusal. The serializers read the
|
|
86
|
+
* whole chain rather than the wrapper alone.
|
|
87
|
+
*
|
|
88
|
+
* @param err what was thrown, which need not be an error
|
|
89
|
+
* @returns the errors of the chain, the outermost first
|
|
90
|
+
*/
|
|
91
|
+
export declare const errorChain: (err: unknown) => Error[];
|
|
92
|
+
/**
|
|
93
|
+
* Whether an error is, or wraps through `cause`, an authorization plugin's
|
|
94
|
+
* refusal.
|
|
95
|
+
*
|
|
96
|
+
* Read by the `authzRefusal` marker rather than by class: a plugin loaded
|
|
97
|
+
* from `dist` while its caller runs from `src` throws a `AuthzRefusedError`
|
|
98
|
+
* whose `instanceof` answers false, and a subclass that replaces `name`
|
|
99
|
+
* would escape a name test — the refusal would then be answered as the
|
|
100
|
+
* wrapper's own error.
|
|
101
|
+
*
|
|
102
|
+
* @param err what was thrown
|
|
103
|
+
* @returns true for a refusal, or for an error wrapping one
|
|
104
|
+
*/
|
|
105
|
+
export declare const isAuthzRefusal: (err: unknown) => boolean;
|
|
106
|
+
/**
|
|
107
|
+
* The status a thrown thing is answered with.
|
|
108
|
+
*
|
|
109
|
+
* The first error from the outside that names one decides: a wrapper names
|
|
110
|
+
* none, so the error it wraps is read; a layer that translates an inner error
|
|
111
|
+
* keeps its own status. `statusCode` is the convention of this module, while
|
|
112
|
+
* Express's router sets `status` alone on the errors it throws.
|
|
113
|
+
*
|
|
114
|
+
* @param err what was thrown
|
|
115
|
+
* @returns its status code, 500 when it names none
|
|
116
|
+
*/
|
|
117
|
+
export declare const statusCodeOf: (err: unknown) => number;
|
|
62
118
|
/**
|
|
63
119
|
* An identity that names more than one directory entry.
|
|
64
120
|
*
|
|
@@ -69,7 +125,7 @@ export declare class ForbiddenError extends HttpError {
|
|
|
69
125
|
* rather than a `null`: a `null` resolution is what
|
|
70
126
|
* `--authz-unresolved-user allow` lets through unchecked.
|
|
71
127
|
*/
|
|
72
|
-
export declare class AmbiguousIdentityError extends
|
|
128
|
+
export declare class AmbiguousIdentityError extends AuthzRefusedError {
|
|
73
129
|
identity: string;
|
|
74
130
|
count: number;
|
|
75
131
|
constructor(identity: string, count: number);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standard express responses and express utilities
|
|
3
|
-
* @author Xavier Guimard <xguimard@linagora.com>
|
|
4
|
-
*/
|
|
5
1
|
import type { Request, Response } from 'express';
|
|
6
2
|
import type winston from 'winston';
|
|
3
|
+
import { type Refusal } from './errors';
|
|
7
4
|
/**
|
|
8
5
|
* Install the logger, or remove it: a test restores the state it found,
|
|
9
6
|
* which before any `DM` is none.
|
|
@@ -21,9 +18,47 @@ export declare const getLogger: () => winston.Logger | undefined;
|
|
|
21
18
|
*/
|
|
22
19
|
export declare const setDebug: (debug: boolean) => void;
|
|
23
20
|
/**
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
*
|
|
21
|
+
* The sentence a client is told of a client error: an authorization
|
|
22
|
+
* plugin's refusal says nothing of the branch it judged.
|
|
23
|
+
*
|
|
24
|
+
* Any other client error keeps the sentence of the outermost error, the one
|
|
25
|
+
* the route threw when it gave up: it says what the caller's request was
|
|
26
|
+
* about, which the `HttpError` several layers down does not.
|
|
27
|
+
*
|
|
28
|
+
* @param err what was thrown
|
|
29
|
+
* @returns the sentence to answer
|
|
30
|
+
*/
|
|
31
|
+
export declare const clientMessageOf: (err: unknown) => string;
|
|
32
|
+
/**
|
|
33
|
+
* The message of a thrown thing, read the way the log reads it.
|
|
34
|
+
*
|
|
35
|
+
* @param err what was thrown
|
|
36
|
+
* @returns its message, or the value as a string
|
|
37
|
+
*/
|
|
38
|
+
export declare const messageOf: (err: unknown) => string;
|
|
39
|
+
/**
|
|
40
|
+
* What an error is answered with, for the error middleware of `DM` and
|
|
41
|
+
* `serverError` alike: one status and one body, wherever the handler called
|
|
42
|
+
* a helper or threw.
|
|
43
|
+
*
|
|
44
|
+
* An authorization plugin's refusal loses its status when a plugin wraps it
|
|
45
|
+
* as a plain `Error`; it is still a 403, whatever the wrapper says. The
|
|
46
|
+
* failure of a 5xx is for the logs, and is named in the body only under
|
|
47
|
+
* `--debug`.
|
|
48
|
+
*
|
|
49
|
+
* @param err what failed
|
|
50
|
+
* @param debug whether to name a failure in the answer
|
|
51
|
+
* @returns the status and body to answer
|
|
52
|
+
*/
|
|
53
|
+
export declare const errorResponse: (err: unknown, debug?: boolean) => {
|
|
54
|
+
status: number;
|
|
55
|
+
body: {
|
|
56
|
+
error: string;
|
|
57
|
+
} & Partial<Refusal>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The body of a 5xx answer, for every status answered when the failure is
|
|
61
|
+
* the server's: the message names the failure only under `--debug`.
|
|
27
62
|
*
|
|
28
63
|
* @param err what failed
|
|
29
64
|
* @param debug whether to name the failure; `serverError`'s setting by default
|
|
@@ -34,6 +69,13 @@ export declare const serverErrorBody: (err: unknown, debug?: boolean) => {
|
|
|
34
69
|
};
|
|
35
70
|
export declare const tryMethod: (res: Response, method: Function, ...args: unknown[]) => Promise<void>;
|
|
36
71
|
export declare const tryMethodData: (res: Response, method: Function, ...args: unknown[]) => Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* The answer of a route that changed something and returned nothing: the
|
|
74
|
+
* shape every write route declares as its 200.
|
|
75
|
+
*/
|
|
76
|
+
export declare const WriteResponse: import("@sinclair/typebox").TObject<{
|
|
77
|
+
success: import("@sinclair/typebox").TBoolean;
|
|
78
|
+
}>;
|
|
37
79
|
export declare const ok: (res: Response, data?: object) => void;
|
|
38
80
|
export declare const created: (res: Response, data?: object) => void;
|
|
39
81
|
export declare const noContent: (res: Response) => void;
|