From 1e839d7992e8c3c147b57373328ae7969d1f69b9 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Fri, 12 Jul 2024 13:19:52 +0200
Subject: [PATCH] update docs

---
 docs/20_Usage.md         |  2 +-
 docs/40_Configuration.md |  2 +-
 docs/50_Examples.md      | 26 +++++++++++++++++++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/docs/20_Usage.md b/docs/20_Usage.md
index 0bd76be..07dbb41 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 9d9fff5..6c138cd 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 c657809..294d275 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();
 ```
-- 
GitLab