diff --git a/docs/20_Usage.md b/docs/20_Usage.md index 0bd76bef6f5f96be476487e616bc496663317ba1..07dbb413ecde459b06f7e509bf766e09ffaa96a6 100644 --- a/docs/20_Usage.md +++ b/docs/20_Usage.md @@ -31,7 +31,7 @@ return [ $aConfig = require_once('inc_config.php'); require_once '[APPROOT]/classes/ldap.class.php'; -$oLdap=new imlldap($aConfig['ldap-maser']); +$oLdap=new imlldap($aConfig['ldap-master']); ``` ## Methods diff --git a/docs/40_Configuration.md b/docs/40_Configuration.md index 9d9fff5a043c8856421a200bb7f66549acaf3909..6c138cdc8d2107691a5c452e0a7c0da38f7d8429 100644 --- a/docs/40_Configuration.md +++ b/docs/40_Configuration.md @@ -33,7 +33,7 @@ return [ $aConfig = require_once('inc_config.php'); require_once '[APPROOT]/classes/ldap.class.php'; -$oLdap=new imlldap($aConfig['ldap-maser']); +$oLdap=new imlldap($aConfig['ldap-master']); // ... diff --git a/docs/50_Examples.md b/docs/50_Examples.md index c6578098a527ce440a7057e403de9643961f2c11..294d275303754c35ec93adfb16044ba5ef5b7044 100644 --- a/docs/50_Examples.md +++ b/docs/50_Examples.md @@ -42,7 +42,31 @@ $oLdap = new imlldap($aConfig); $oLdap->debugOn(); // then do something ... the first action will conect and bind +``` + +## Add a member + +This snippet is a function to add eg a user DN as member to an application or other group. + +```php +/* +string $sDn DN i.e. of an application / group that has member entries +string $sMemberDN DN of a user or for smb group: uid of member +string $sAttribute attribute to handle; default: member; for smb group "memberUid" +*/ + +$oLdap=new imlldap($aConfig['ldap-master']); if ($oLdap->objectAttributeAndValueExist($sDn, $sAttribute, $sMemberDN)) { - ... + // SKIP - $sMemberDN is a member in $sDn already + // ... +} else { + if ($oLdap->objAddAttr($sDn, array($sAttribute => $sMemberDN))) { + // OK - member was added + // ... + } else { + // ERROR - adding the member failed + // ... + } } +$oLdap->close(); ```