-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
edvler
committed
Sep 16, 2017
1 parent
d2bce8d
commit b24aafb
Showing
2 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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', | ||
//... | ||
|
@@ -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() | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters