ldap-rest 0.1.7 → 0.1.8
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/dist/abstract/ldapFlat.js +1 -1
- package/dist/bin/index.js +1 -1
- package/dist/lib/ldapActions.js +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/plugins/auth/token.js +1 -1
- package/dist/plugins/ldap/groups.js +1 -1
- package/dist/plugins/ldap/organization.js +1 -1
- package/dist/plugins/twake/calendarResources.js +1 -1
- package/dist/plugins/twake/james.js +1 -1
- package/dist/src/abstract/ldapFlat.d.ts +0 -9
- package/dist/src/lib/parseConfig.d.ts +1 -2
- package/dist/src/lib/utils.d.ts +17 -0
- package/dist/src/plugins/ldap/groups.d.ts +0 -9
- package/dist/src/plugins/twake/calendarResources.d.ts +9 -0
- package/dist/src/plugins/twake/james.d.ts +8 -0
- package/docs/usage/plugins/integrations/calendar-resources.md +43 -0
- package/docs/usage/plugins/integrations/james-mail.md +238 -0
- package/package.json +165 -165
|
@@ -303,6 +303,244 @@ curl http://localhost:8081/api/v1/users/jdoe/quota-usage \
|
|
|
303
303
|
-H "Authorization: Bearer admin-token"
|
|
304
304
|
```
|
|
305
305
|
|
|
306
|
+
## Public Methods
|
|
307
|
+
|
|
308
|
+
Public methods available on the James plugin instance. Useful for building GDPR workflows, custom integrations, or calling from other plugins.
|
|
309
|
+
|
|
310
|
+
### Usage
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
import type { DM } from 'ldap-rest';
|
|
314
|
+
import type James from 'ldap-rest/plugin-twake-james';
|
|
315
|
+
|
|
316
|
+
// Get the James plugin instance
|
|
317
|
+
const james = server.getPlugin('james') as James;
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### deleteUserData(mail, fromStep?)
|
|
321
|
+
|
|
322
|
+
Delete all user data via James WebAdmin API. Useful for GDPR "right to be forgotten" compliance.
|
|
323
|
+
|
|
324
|
+
**Signature:**
|
|
325
|
+
|
|
326
|
+
```typescript
|
|
327
|
+
async deleteUserData(mail: string, fromStep?: string): Promise<{ taskId: string } | null>
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Parameters:**
|
|
331
|
+
|
|
332
|
+
- `mail` (string): User's email address
|
|
333
|
+
- `fromStep` (string, optional): Resume deletion from a specific step if a previous attempt failed
|
|
334
|
+
|
|
335
|
+
**Returns:** Task information with `taskId`, or `null` on error.
|
|
336
|
+
|
|
337
|
+
**Example:**
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
const result = await james.deleteUserData('user@example.com');
|
|
341
|
+
if (result) {
|
|
342
|
+
console.log(`Deletion task started: ${result.taskId}`);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// Resume from a failed step
|
|
346
|
+
const resumed = await james.deleteUserData(
|
|
347
|
+
'user@example.com',
|
|
348
|
+
'DeleteMailboxesStep'
|
|
349
|
+
);
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**Reference:** [James deleteData API](https://james.apache.org/server/manage-webadmin.html#delete-data-of-a-user)
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
### getMailFromDN(dn)
|
|
357
|
+
|
|
358
|
+
Retrieve the email address for a user given their LDAP DN.
|
|
359
|
+
|
|
360
|
+
**Signature:**
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
async getMailFromDN(dn: string): Promise<string | null>
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**Parameters:**
|
|
367
|
+
|
|
368
|
+
- `dn` (string): LDAP Distinguished Name of the user
|
|
369
|
+
|
|
370
|
+
**Returns:** Email address string, or `null` if not found.
|
|
371
|
+
|
|
372
|
+
**Example:**
|
|
373
|
+
|
|
374
|
+
```typescript
|
|
375
|
+
const mail = await james.getMailFromDN('uid=jdoe,ou=users,dc=example,dc=com');
|
|
376
|
+
// Returns: "jdoe@example.com"
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
### getDisplayNameFromDN(dn)
|
|
382
|
+
|
|
383
|
+
Retrieve the display name for a user given their LDAP DN. Uses fallback logic: `displayName` → `cn` → `givenName sn` → `mail`.
|
|
384
|
+
|
|
385
|
+
**Signature:**
|
|
386
|
+
|
|
387
|
+
```typescript
|
|
388
|
+
async getDisplayNameFromDN(dn: string): Promise<string | null>
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
**Parameters:**
|
|
392
|
+
|
|
393
|
+
- `dn` (string): LDAP Distinguished Name of the user
|
|
394
|
+
|
|
395
|
+
**Returns:** Display name string, or `null` if not found.
|
|
396
|
+
|
|
397
|
+
**Example:**
|
|
398
|
+
|
|
399
|
+
```typescript
|
|
400
|
+
const name = await james.getDisplayNameFromDN(
|
|
401
|
+
'uid=jdoe,ou=users,dc=example,dc=com'
|
|
402
|
+
);
|
|
403
|
+
// Returns: "John Doe"
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
### generateSignature(dn)
|
|
409
|
+
|
|
410
|
+
Generate an HTML email signature for a user using the configured template (`--james-signature-template`).
|
|
411
|
+
|
|
412
|
+
**Signature:**
|
|
413
|
+
|
|
414
|
+
```typescript
|
|
415
|
+
async generateSignature(dn: string): Promise<string | null>
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
**Parameters:**
|
|
419
|
+
|
|
420
|
+
- `dn` (string): LDAP Distinguished Name of the user
|
|
421
|
+
|
|
422
|
+
**Returns:** HTML signature string with placeholders replaced, or `null` if no template configured.
|
|
423
|
+
|
|
424
|
+
**Example:**
|
|
425
|
+
|
|
426
|
+
```typescript
|
|
427
|
+
// With template: "<p>{displayName}</p><p>{title} - {department}</p>"
|
|
428
|
+
const signature = await james.generateSignature(
|
|
429
|
+
'uid=jdoe,ou=users,dc=example,dc=com'
|
|
430
|
+
);
|
|
431
|
+
// Returns: "<p>John Doe</p><p>Engineer - IT</p>"
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
### updateJamesIdentity(dn, mail, displayName)
|
|
437
|
+
|
|
438
|
+
Update a user's JMAP identity in James (name and optional signature).
|
|
439
|
+
|
|
440
|
+
**Signature:**
|
|
441
|
+
|
|
442
|
+
```typescript
|
|
443
|
+
async updateJamesIdentity(dn: string, mail: string, displayName: string): Promise<void>
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
**Parameters:**
|
|
447
|
+
|
|
448
|
+
- `dn` (string): LDAP Distinguished Name (used for signature generation)
|
|
449
|
+
- `mail` (string): User's email address
|
|
450
|
+
- `displayName` (string): New display name for the identity
|
|
451
|
+
|
|
452
|
+
**Example:**
|
|
453
|
+
|
|
454
|
+
```typescript
|
|
455
|
+
await james.updateJamesIdentity(
|
|
456
|
+
'uid=jdoe,ou=users,dc=example,dc=com',
|
|
457
|
+
'jdoe@example.com',
|
|
458
|
+
'John Doe'
|
|
459
|
+
);
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
### getMemberEmails(memberDns)
|
|
465
|
+
|
|
466
|
+
Retrieve email addresses for multiple LDAP members. Useful for bulk operations on groups.
|
|
467
|
+
|
|
468
|
+
**Signature:**
|
|
469
|
+
|
|
470
|
+
```typescript
|
|
471
|
+
async getMemberEmails(memberDns: string[]): Promise<string[]>
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
**Parameters:**
|
|
475
|
+
|
|
476
|
+
- `memberDns` (string[]): Array of LDAP Distinguished Names
|
|
477
|
+
|
|
478
|
+
**Returns:** Array of email addresses (excludes members without mail attribute).
|
|
479
|
+
|
|
480
|
+
**Example:**
|
|
481
|
+
|
|
482
|
+
```typescript
|
|
483
|
+
const emails = await james.getMemberEmails([
|
|
484
|
+
'uid=alice,ou=users,dc=example,dc=com',
|
|
485
|
+
'uid=bob,ou=users,dc=example,dc=com',
|
|
486
|
+
]);
|
|
487
|
+
// Returns: ["alice@example.com", "bob@example.com"]
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
---
|
|
491
|
+
|
|
492
|
+
### getGroupMail(groupDn)
|
|
493
|
+
|
|
494
|
+
Retrieve the email address for a group given its LDAP DN.
|
|
495
|
+
|
|
496
|
+
**Signature:**
|
|
497
|
+
|
|
498
|
+
```typescript
|
|
499
|
+
async getGroupMail(groupDn: string): Promise<string | null>
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
**Parameters:**
|
|
503
|
+
|
|
504
|
+
- `groupDn` (string): LDAP Distinguished Name of the group
|
|
505
|
+
|
|
506
|
+
**Returns:** Group email address, or `null` if not found.
|
|
507
|
+
|
|
508
|
+
**Example:**
|
|
509
|
+
|
|
510
|
+
```typescript
|
|
511
|
+
const mail = await james.getGroupMail(
|
|
512
|
+
'cn=engineering,ou=groups,dc=example,dc=com'
|
|
513
|
+
);
|
|
514
|
+
// Returns: "engineering@example.com"
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
### getGroupMailboxType(groupDn)
|
|
520
|
+
|
|
521
|
+
Retrieve the mailbox type for a group (mailing list, team mailbox, or simple group).
|
|
522
|
+
|
|
523
|
+
**Signature:**
|
|
524
|
+
|
|
525
|
+
```typescript
|
|
526
|
+
async getGroupMailboxType(groupDn: string): Promise<'group' | 'mailingList' | 'teamMailbox' | null>
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
**Parameters:**
|
|
530
|
+
|
|
531
|
+
- `groupDn` (string): LDAP Distinguished Name of the group
|
|
532
|
+
|
|
533
|
+
**Returns:** Mailbox type string, or `null` if not determinable.
|
|
534
|
+
|
|
535
|
+
**Example:**
|
|
536
|
+
|
|
537
|
+
```typescript
|
|
538
|
+
const type = await james.getGroupMailboxType(
|
|
539
|
+
'cn=engineering,ou=groups,dc=example,dc=com'
|
|
540
|
+
);
|
|
541
|
+
// Returns: "mailingList" or "teamMailbox" or "group"
|
|
542
|
+
```
|
|
543
|
+
|
|
306
544
|
## James WebAdmin API
|
|
307
545
|
|
|
308
546
|
### Endpoints Used
|