Added ldap module to tests

This commit is contained in:
Lucas Bartholemy 2019-03-21 14:20:02 +01:00
parent fa2191e9d7
commit 64695d63a2
2 changed files with 4 additions and 3 deletions

View File

@ -199,7 +199,7 @@ class LdapController extends \yii\console\Controller
$authClient = $newAuthClient->getAuthClientInstance($userEntry);
$attributes = $authClient->getUserAttributes();
if (isset($attributes['id'])) {
if (!isset($attributes['id'])) {
print "Skipped - No ID for: " . $attributes['dn'] . "\n";
continue;
}
@ -207,7 +207,7 @@ class LdapController extends \yii\console\Controller
// Fix empty 'authclient_id' by e-mail
if (isset($attributes['email'])) {
$user = User::find()->where(['email' => $attributes['email']])->andWhere(['IS', 'authclient_id', new Expression('NULL')])->one();
if ($user !== null) {
if ($user !== null && User::findOne(['authclient_id' => $attributes['id']]) === null) {
$user->updateAttributes(['authclient_id' => $attributes['id']]);
$d++;
}
@ -216,7 +216,7 @@ class LdapController extends \yii\console\Controller
// Fix empty 'authclient_id' by username
if (isset($attributes['username'])) {
$user = User::find()->where(['username' => $attributes['username']])->andWhere(['IS', 'authclient_id', new Expression('NULL')])->one();
if ($user !== null) {
if ($user !== null && User::findOne(['authclient_id' => $attributes['id']]) === null) {
$user->updateAttributes(['authclient_id' => $attributes['id']]);
$d++;
}

View File

@ -39,6 +39,7 @@ class ModuleAutoLoaderTest extends Unit
'tour',
'ui',
'user',
'ldap',
];
/**