Skip to content

Commit

Permalink
Merge pull request liberkee#48 from hufsm/feature/XPLHUFRO-58_Documen…
Browse files Browse the repository at this point in the history
…tation_updates

Typos, spelling and some updates.
  • Loading branch information
Radu94 authored Feb 1, 2018
2 parents 52a2d66 + 9c2bb11 commit f684dc6
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 18 deletions.
8 changes: 4 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ const ldapClient = new LDAP('your_ldap_host_address'); // E.g: ldap://192.168.0.


/* in order for the client to be usable, it has to be initialized and bound with a user DN and a password */
/* The anonymous users can use just the ldap extended operation */
/* The anonymous users(unbound) can only use the ldap extended operation */
ldapClient.initialize()
.then( () => {
.then(() => {
return ldapClient.bind('validDn','password')
})
.then( () => {
.then(() => {
//after the client is initialized and bound, you can add,search,etc.
})
.catch( (customError) => {
.catch((customError) => {
//custom errors have a description and a code field that you can inspect
})

Expand Down
2 changes: 2 additions & 0 deletions docs/errors.MD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ ldapClient.add(dn,entry)
//LdapAlreadyExistsError with error code 68
})
.catch(LdapInvalidSyntaxError, (err) => {
// toString() displays error.code: error.description
console.log(err.toString());
//catching specific errors
})
```
Expand Down
2 changes: 1 addition & 1 deletion docs/ldap_functions/changePassword.MD
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ A promise returning function that wraps the `ldap_paswd` C function from the ope

## References:

* [Nan Add Wrapper](../../src/binding.cc) & [AsyncProgress Worker](../../src/ldap_changePassword_progress.cc)
* [Nan Wrapper](../../src/binding.cc) & [AsyncProgress Worker](../../src/ldap_changePassword_progress.cc)
* [Javascript Source Code](../../libs/ldap_async_wrap.js)
14 changes: 7 additions & 7 deletions docs/ldap_functions/extendedOperation.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
ldap.extendedOperation(oid,values,timeOut);
```

* `oid` The operation OID that is send it for request.
* `values` This parameter is used to provide the specific value for operation. The value can be an Array of elements or just a single element _Optional_
* `timeOut` The maximum amount of time the server should take in responding the add operation (in seconds).. _Optional_
* `oid` The operation ID that is sent. This maps to a specific extended operation.
* `values` This parameter is used to provide the specific value for operation. It can be an Array of elements or just a single element _Optional_
* `timeOut` The maximum amount of time the server should take in responding to the request (in seconds).. _Optional_

Example usecase:
Example use case:

```javascript
ldap.initialize()
Expand All @@ -18,16 +18,16 @@ ldap.initialize()

```

A promise returning function that wraps the `ldap_extended_operation` C asynchronous function from the openldap API. In Case of success it fulfils with the result from the extended operation function with a result if the operation provide a result or just with a success value. In case of failure, it throws a custom error that can be further inspected for the cause.
A promise returning function that wraps the `ldap_extended_operation` C asynchronous function from the openldap API. In Case of success it fulfils with the result from the extended operation function, if the operation provides a result, or just with a success value(0). In case of failure, it throws a custom error that can be further inspected for the cause.

The OID that are implemented and tested are:
The OIDs that are implemented and tested are:
* [1.3.6.1.1.8/LDAP Cancel operation](https://tools.ietf.org/html/rfc3909)
* [1.3.6.1.4.1.4203.1.11.1/LDAP Password Modify Operation](https://tools.ietf.org/html/rfc3062)
* [1.3.6.1.4.1.4203.1.11.3/LDAP Who am I Operation](https://tools.ietf.org/html/rfc4532)
* [1.3.6.1.4.1.1466.20037/LDAP StartTLS Operation](https://tools.ietf.org/html/rfc2830)
* [1.3.6.1.4.1.1466.101.119.1/LDAP Refresh Operation](https://tools.ietf.org/html/rfc4533#section-3.8)
Some OID request require extra information and that is given in the value parameter. Because every operation is uniq the value are different and them are need to be construct in a specific way if you want other extended operation fell free to make a pull request with them.

Some OID requests require extra information that is provided in the `value` parameter. Values are usually specific to each extended op, for now this library supports just the ones mentioned above.
## References:

* [LDAP Add manpage](https://linux.die.net/man/3/ldap_extended_operation)
Expand Down
33 changes: 31 additions & 2 deletions docs/ldap_functions/modify.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,36 @@
* `dn` entry that will be modified.
* `changes` Object that contains changes to be made.
* `optionalControls` One or more ldap [Control](../controls.MD). _Optional_
* `timeVal` The maxim amount of time the server should take in responding the modify operation (in seconds). _Optional_
* `timeVal` The maximum amount of time the server should take in responding to the request (in seconds). _Optional_

The Modify Operation has four ways in which it can be used to change attribute data from LDAP entries:

* `add` Will add a new attribute value to an existing ldap entry.
* `delete` Will remove an existing value from an attribute.
* `replace` This operation will delete all the old values from an attribute and add the new list of values provided by the user.
* `update` This operation take a value or multiple values of an attribute and updates them to new values.

Update object example:

```javascript

const changes = {
op: 'update', // type of change required, can be either add, replace, delete or update
attr: 'description', // attribute to be modified
vals: [
{
oldVal: 'OldDescription',
newVal: 'NewDescription'
}
{
oldVal: 'OldDescription2',
newVal: 'NewDescription2'
}
]
}


```

Modify example:

Expand All @@ -18,7 +47,7 @@ const preRead = '1.3.6.1.1.13.1';
const postRead = '1.3.6.1.1.13.2';

const changes = {
op: 'replace', // type of change required, can be either add, replace or delete
op: 'replace', // type of change required, can be either add, replace, delete or update
attr: 'sn', // attribute to be modified
vals: ['New Address, nr 23'] // new value(s)

Expand Down
2 changes: 1 addition & 1 deletion docs/ldap_functions/pagedSearch.MD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* `scope` The scope of the search and should be one of BASE, to search the object itself, ONE to search the object's immediate children or SUBTREE to search the object and all its descendants.
* `searchFilter` A string representation of the filter to apply in the search. If omitted, the default ldap filter will be used, searching for everything.
* `pageSize` how many results should be displayed on each page.
* `timeVal` The maxim amount of time the server should take in responding the page search operation (in seconds). _Optional_
* `timeVal` The maximum amount of time the server should take in responding to the request (in seconds). _Optional_

A Promise returning function that resolves to a readable stream, chunking the results page by page. This should be used instead of the regular search if a large number of results is expected.

Expand Down
2 changes: 1 addition & 1 deletion docs/ldap_functions/rename.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* `newRdn` The new relative distinguished name for the dn.
* `newParent` The new parent for the rdn.
* `optionalControls` One or more ldap [Control](../controls.MD). _Optional_
* `timeVal` The maxim amount of time the server should take in responding the rename operation (in seconds). _Optional_
* `timeVal` The maximum amount of time the server should take in responding to the request (in seconds). _Optional_

A promise returning function that wraps the `ldap_rename` C function from the openldap API. In Case of success it fulfils with the result from the rename function ( whichever controls the user specified). In case of failure, it throws a custom error that can be further inspected for the cause.

Expand Down
4 changes: 2 additions & 2 deletions docs/ldap_functions/search.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ldap.search(searchBase, scope, searchFilter, timeVal)

* `searchBase` The DN of the entry at which to start the search.
* `scope` The scope of the search and should be one of BASE, to search the object itself, ONE to search the object's immediate children or SUBTREE to search the object and all its descendants.
* `searchFilter` A string representation of the filter to apply in the search
* `timeVal` The maxim amount of time the server should take in responding the rename operation (in seconds). _Optional_
* `searchFilter` A string representation of the filter to apply in the search. If omitted, the default search filter will be used (objectClass=*), searching for everything.
* `timeVal` The maximum amount of time the server should take in responding to the request (in seconds). _Optional_

A Promise returning function that wraps the asynchronous `ldap_search_ext` C function from the openldap C API. It fulfils with the value of the search result or rejects with a custom error that can be further inspected.

Expand Down

0 comments on commit f684dc6

Please sign in to comment.