Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit d8c2524

Browse files
authored
docs: attr value
1 parent 97ed088 commit d8c2524

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/guide.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ the following code in as another handler (you'll need a
403403
if (!req.dn.rdns[0].attrs.cn)
404404
return next(new ldap.ConstraintViolationError('cn required'));
405405

406-
if (req.users[req.dn.rdns[0].attrs.cn])
406+
if (req.users[req.dn.rdns[0].attrs.cn.value])
407407
return next(new ldap.EntryAlreadyExistsError(req.dn.toString()));
408408

409409
var entry = req.toObject().attributes;
@@ -490,7 +490,7 @@ As before, here's a breakdown of the code:
490490
if (!req.dn.rdns[0].attrs.cn)
491491
return next(new ldap.ConstraintViolationError('cn required'));
492492

493-
if (req.users[req.dn.rdns[0].attrs.cn])
493+
if (req.users[req.dn.rdns[0].attrs.cn.value])
494494
return next(new ldap.EntryAlreadyExistsError(req.dn.toString()));
495495

496496
var entry = req.toObject().attributes;
@@ -532,13 +532,13 @@ RFC, so appending, removing, or replacing a single attribute is pretty natural.
532532
Go ahead and add the following code into your source file:
533533

534534
server.modify('ou=users, o=myhost', pre, function(req, res, next) {
535-
if (!req.dn.rdns[0].attrs.cn || !req.users[req.dn.rdns[0].attrs.cn])
535+
if (!req.dn.rdns[0].attrs.cn || !req.users[req.dn.rdns[0].attrs.cn.value])
536536
return next(new ldap.NoSuchObjectError(req.dn.toString()));
537537

538538
if (!req.changes.length)
539539
return next(new ldap.ProtocolError('changes required'));
540540

541-
var user = req.users[req.dn.rdns[0].attrs.cn].attributes;
541+
var user = req.users[req.dn.rdns[0].attrs.cn.value].attributes;
542542
var mod;
543543

544544
for (var i = 0; i < req.changes.length; i++) {
@@ -594,10 +594,10 @@ Delete is pretty straightforward. The client gives you a dn to delete, and you
594594
delete it :). Add the following code into your server:
595595

596596
server.del('ou=users, o=myhost', pre, function(req, res, next) {
597-
if (!req.dn.rdns[0].attrs.cn || !req.users[req.dn.rdns[0].attrs.cn])
597+
if (!req.dn.rdns[0].attrs.cn || !req.users[req.dn.rdns[0].attrs.cn.value])
598598
return next(new ldap.NoSuchObjectError(req.dn.toString()));
599599

600-
var userdel = spawn('userdel', ['-f', req.dn.rdns[0].cn]);
600+
var userdel = spawn('userdel', ['-f', req.dn.rdns[0].attrs.cn.value]);
601601

602602
var messages = [];
603603
userdel.stdout.on('data', function(data) {

0 commit comments

Comments
 (0)