diff --git a/docs/10_Installation.md b/docs/10_Installation.md new file mode 100644 index 0000000000000000000000000000000000000000..0e8ec5342b8b3c0fa690c7a22f2887c758332466 --- /dev/null +++ b/docs/10_Installation.md @@ -0,0 +1,18 @@ +# Installation + +## Clone the repo somewhere + +```shell +mkdir vendor +cd vendor +git clone https://git-repo.iml.unibe.ch/iml-open-source/ldap-php-class.git +cd ldap-php-class +``` + +## Copy the class file + +The class file is in the src subdir. Copy it into your project ... into your classes folder + +```shell +cp src/ldap.class.php /var/www/myproject/classes +``` diff --git a/docs/20_Usage.md b/docs/20_Usage.md new file mode 100644 index 0000000000000000000000000000000000000000..595e75933ccab564e3067ad5ce21e4d25a0c3161 --- /dev/null +++ b/docs/20_Usage.md @@ -0,0 +1,47 @@ +# Usage + +## Include the ldap class + +```php +require_once '[APPROOT]/classes/ldap.class.php'; +``` + +## Create a config with connection data + +As an example I create a hash named $aConfig and save it as "inc_config.php". + +```php +$aConfig=[ + ... + + 'ldap' => [ + 'server' => 'ldaps://ldap.example.com', + 'port' => 636, + 'DnLdapUser' => 'cn=Lookup,ou=Service,dc=some,dc=example.com', + 'PwLdapUser' => 'PasswordOfLookupUser', + + // node where to find users that are allowed to login + 'DnUserNode' => 'ou=People,dc=some,dc=example.com', + + // node where to find my app + 'DnAppNode' => 'cn=MyApp,dc=some,dc=example.com', + 'debugLevel' => 0, + ], + ... + +]; +``` + +## Example: verify login data + +```php +require_once('inc_config.php'); +require_once '[APPROOT]/classes/ldap.class.php'; + +oLdap=new imlldap($aConfig['ldap']); + +// set values from $_FORM or $_POST data of your login form here +// The variable $bAuthenticated is true if authentication of the user was successful. +$bAuthenticated=oLdap->verifyPassword($sUser, $sPassword); + +``` diff --git a/docs/README.md b/docs/_index.md similarity index 59% rename from docs/README.md rename to docs/_index.md index 0bfad6ad64cf5f683e86c1d4a0e279a28436c4f9..074f0b26c1b2f2ed37a9648729d13c0cac2d8d16 100644 --- a/docs/README.md +++ b/docs/_index.md @@ -5,8 +5,12 @@ A PHP class that I use * for authentication of user logins * CRUD actions on ldap nodes +Institute for Medical Education; University of Bern + +License: GNU GPL 3 + ## Requirements * PHP 7+ * Php Ldap module -* OpenLdap +* OpenLdap server to connect diff --git a/docs/config.json b/docs/config.json new file mode 100644 index 0000000000000000000000000000000000000000..067fc21174eaee701f9e72e060b88e0022f486d3 --- /dev/null +++ b/docs/config.json @@ -0,0 +1,17 @@ +{ + "title": "IML Ldap Class (PHP)", + "author": "Axel Hahn", + "tagline": "Openldap helper class", + + "html": { + "auto_toc": true, + "auto_landing": false, + "date_modified": true, + "jump_buttons": true, + "links": { + "Repo": "https://git-repo.iml.unibe.ch/iml-open-source/ldap-php-class/" + }, + "theme": "daux-blue", + "search": true + } +} \ No newline at end of file diff --git a/docs/style.css b/docs/style.css new file mode 100644 index 0000000000000000000000000000000000000000..02b2415b02181d56d377762e0cac369c011c03d4 --- /dev/null +++ b/docs/style.css @@ -0,0 +1,165 @@ +/* + + patch css elements of daux.io blue theme + +*/ + + +/* ---------- vars ---------- */ + +:root{ + + /* background colors */ + --bg:none; + --bg-body: #fff; + --bg-navlinkactive:#f4f4f4; + --bg-navlinkactive: linear-gradient(-90deg,rgba(0,0,0,0), rgba(40,60,80,0.05) 30%); + --bg-pre:#f8f8f8; + --bg-toc: #fff; + + /* foreground colors */ + --color: #234; + --navlinkactive:#f33; + --title: #aaa; + + --link:#12a; + --toclink:rgba(40,60,80,0.8); + + --h1: rgba(40,60,80,0.8); + --h1-bottom: 1px solid rgba(40,60,80,0.1); + --h2: rgba(40,60,80,0.5); + --h3: rgba(40,60,80,0.3); + +} + +/* ---------- tags ---------- */ + +body, *{color: var(--color); } +body{background: var(--bg-body);} + + +a{color: var(--link);} +a:hover{opacity: 0.7;} + +h1>a{ color:var(--title);} +_h1:nth-child(1){position: fixed; background: var(--bg); box-shadow: 0 0 1em #ccc; padding: 0 1em} +h1:nth-child(1)>a{ color:var(--navlinkactive); } + +.s-content h1{color: var(--h1); font-size: 200%; font-weight:bold; margin-top: 2em; border-bottom: var(--h1-bottom);} +.s-content h2{color: var(--h2); font-size: 160%; } +.s-content h3{color: var(--h3); font-size: 140%; } +.s-content h4{margin: 0; font-size: 100%; text-align: center; background-color: rgba(0,0,0,0.05);padding: 0.3em;} + +.s-content pre{ + background: var(--bg-pre); +} + +/* ---------- classes ---------- */ + +.required{color:#a42;} +.optional{color:#888;} + + +/* ----- top left */ +.Brand, +.Columns__left { + background: var(--bg); + border-right: 0px solid #e7e7e9; + color: var(--color); +} +.Brand{font-size: 200%; + background_: linear-gradient(-10deg,#fff 50%, #ddd); + background: var(--bg); +} +.Columns__right__content { + background: var(--bg); +} + +/* ----- Navi left */ + +.Nav a:hover{ + background: none; + color: var(--navlinkactive) !important; +} + +.Nav__item--active { + border-right_: 0.3em solid var(--navlinkactive); +} +.Nav__item--active > a{ + background: var(--bg-navlinkactive); + color: var(--navlinkactive); +} +.Nav .Nav .Nav__item--active a { + color: var(--navlinkactive); +} +.Nav .Nav .Nav__item a { + opacity: 1; +} +.Nav__item--open > a { + background-color: var(--bg); +} + +.Nav a[href*="__Welcome"]{ + background: url("/icons/house.png") no-repeat 10px 4px ; + padding-left: 40px; +} +.Nav a[href*="__How_does_it_work"]{ + background: url("/icons/light-bulb.png") no-repeat 10px 4px ; + padding-left: 40px; +} + + + + +/* ---------- classes ---------- */ + +/* FIX smaller fnt size in tables */ +.s-content table { + font-size: 1em; +} + + +/* TOC */ +@media(min-width:1700px){ + .TableOfContentsContainer{ + position: fixed; + right: 2em; + top: 1em; + } +} + +.TableOfContentsContainer{ + border-top-left-radius: 1em; + background-color: var(--bg-toc); + border-left: 2px solid rgba(0,0,0,0.05); + padding: 0em; +} +.TableOfContentsContainer__content { + + border: none; + font-size: 0.5em; + +} +ul.TableOfContents ul{ + list-style-type: none; + padding-left: 1em; +} +.TableOfContentsContainer a{ color:var(--toclink);} + +.TableOfContentsContainer__content > .TableOfContents > li + li { + border-top: none; +} +.TableOfContentsContainer__content > .TableOfContents > li { + border-bottom: 1px dashed #ddd; +} + +/* pager - prev .. next */ +.s-content{ + margin-bottom: 6em; +} +.Pager{ + border-top: 1px dashed #aaa; margin: 0; padding: 1em; +} +.Pager a{ + color:var(--navlinkactive); +}