Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
edvler committed Sep 16, 2017
1 parent d2bce8d commit b24aafb
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
20 changes: 18 additions & 2 deletions docs/USAGE_WITH_USER_MODEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ yii migrate --migrationPath=@Edvlerblog/Adldap2/migrations
### 5. Change the identity class in your web.conf (basic template) / main.conf (advanced template).
```php
'components' => [
//...
//user entry already exists!
'user' => [
'identityClass' => 'Edvlerblog\Adldap2\model\UserDbLdap',
//...
Expand All @@ -58,6 +58,7 @@ yii migrate --migrationPath=@Edvlerblog/Adldap2/migrations
```

### 6. In the basic template change the models/LoginForm.php to use the new identity class.
**Version 1 with sAMAccountname attribute (login eg. mmaderer)**
```php
//...
public function getUser()
Expand All @@ -71,6 +72,21 @@ public function getUser()
//...
```

**Version 2 with another attribute (login eg. [email protected])**
```php
//...
public function getUser()
{
if ($this->_user === false) {
$this->_user = \Edvlerblog\Adldap2\model\UserDbLdap::findByAttribute('userPrincipalName',$this->username); //With Principal Name
//$this->_user =\Edvlerblog\Adldap2\model\UserDbLdap::findByAttribute('mail',$this->username); //With Mail
}

return $this->_user;
}
//...
```

### 7. Add the LdapController to the controllerMap in the config/console.conf (basic template) OR console/config/main.conf (advanced template).
Maybe the 'controllerMap' section is commented out.
```php
Expand Down Expand Up @@ -151,7 +167,7 @@ Maybe you think: Configuration, what?? But there are severel possible ways to co
**role** = This term is used for a role in yii2. If you don't know what a role is look at http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#rbac
**group** = This term is used for a group in Active Directory.
**user** = Means a user which exists in Active Directory.
**username or login** = sAMAccountName attribute in Active Directory (the username you type at the windows login)
**username or login** = Depending on Task 1 Number 6 the attribute you used for login.
**assigned group** = Means that a user is member of a group in Active Directory
**assigned role** = Means that a user is member of a role in yii2

Expand Down
28 changes: 26 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@ or add
```
to the require section of your composer.json

## Functions of the Plugin!
It has been a long way since 29. Jan 2014, many functions has been added. I noticed for myself that a short overview might help everyone to see whats possible.

**The simple [Method 1](#usage-method-1-simple-usage-without-a-user-model)**
* Query only informations from Active Directory.


**The deep integration with [Method 2](#usage-method-2-deep-integration-into-the-yii2-framework-with-a-user-model)**
* Sign in with a Active Directory User is possible **without doing anything in yii2**. The only action needed is creating a Active Directory User and add it to a group in Active Directory.
* Full support of the RBAC-concept from yii2
* Default is to login with the sAMAccountName [Edvlerblog\Adldap2\model\UserDbLdap.php::findByUsername($username)](src/model/UserDbLdap.php). But using any attribute is possible [Edvlerblog\Adldap2\model\UserDbLdap.php::findByAttribute($attribute,$searchVAlue)](src/model/UserDbLdap.php).
* Default is, that on login the Active Directory Account Status and the group assignments are checked. Based on the results the login is possible or not.
* You can access every Active Directory attribute of the user. [Method 2](#Usage method 2: Deep integration into the yii2 framework with a user model)
* This yii2-extension is highly configurable.

**How to start??**
* My suggestion is that you should start with Method 1. Start with a configration as described below and do some simple querys. If you see how it works, you can try Method 2.

**If you have some questions...**
* Please see the the separeted howto's for each Method.
* [Method 1: docs/USAGE_WITHOUT_USER_MODEL.md](docs/USAGE_WITHOUT_USER_MODEL.md)
* [Method 2: docs/USAGE_WITH_USER_MODEL.md](docs/USAGE_WITH_USER_MODEL.md)
* You can try to contanct me! If I find time, I would answer your questions!


## Configuration

Expand Down Expand Up @@ -143,9 +167,9 @@ https://github.com/Adldap2/Adldap2/blob/master/docs/configuration.md

### Usage method 1: Simple usage without a user model
If you are need to query some informations for a user from the Active Directory this would be best way.
No additional configuration is needed and the only thing to do is to add the configuration as described above to your components section.
No additional configuration is needed and the only thing to do is to add the [configuration](#configuration) as described above to your components section.

You only call the the component as usual.
You only use the extension in the regular Yii2 style:
```php
//...
$un = 'testuser';
Expand Down

0 comments on commit b24aafb

Please sign in to comment.