diff --git a/docs/examples.md b/docs/examples.md index 71881ef..656bded 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -15,7 +15,9 @@ with ldapjs. ///--- Shared handlers function authorize(req, res, next) { - if (!req.connection.ldap.bindDN.equals('cn=root')) + /* Any user may search after bind, only cn=root has full power */ + var isSearch = (req instanceof ldap.SearchRequest); + if (!req.connection.ldap.bindDN.equals('cn=root') && !isSearch) return next(new ldap.InsufficientAccessRightsError()); return next(); @@ -54,10 +56,10 @@ with ldapjs. if (!db[dn]) return next(new ldap.NoSuchObjectError(dn)); - if (!dn[dn].userpassword) + if (!db[dn].userpassword) return next(new ldap.NoSuchAttributeError('userPassword')); - if (db[dn].userpassword !== req.credentials) + if (db[dn].userpassword.indexOf(req.credentials) === -1) return next(new ldap.InvalidCredentialsError()); res.end(); diff --git a/docs/persistent_search.md b/docs/persistent_search.md deleted file mode 100644 index bf236be..0000000 --- a/docs/persistent_search.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -titile: Persistent Search Cache API| ldapjs -markdown2extras: wiki-tables -logo-color: green -logo-font-family: google:Aldrich, Verdana, sans-serif -header-font-family: google:Aldrich, Verdana, sans-serif ---- - -# ldapjs Persistent Search Cache API - -This document covers the ldapjs Persistent Search Cache API and assumes you are familiar with LDAP. If you're not, read the [guide](http://ldapjs.org/guide.html) first. - -This document also assumes you are familiar with LDAP persistent search. If you're not, read the [rfc](http://tools.ietf.org/id/draft-ietf-ldapext-psearch-03.txt) first. - -Note this API is a cache used to store all connected persistent search clients, and does not actually implement persistent search. - -# addClient(req, res, callback) - -Adds a client to the cache. - -# removeClient(req, res, callback) - -Removes a client from the cache. \ No newline at end of file