Fix #3883: Former & soft deleted LDAP user produces multiple warnings

This commit is contained in:
Lucas Bartholemy 2020-02-27 11:27:14 +01:00
parent 59453d11e5
commit ca3833e6e1
4 changed files with 48 additions and 4 deletions

View File

@ -1,7 +1,7 @@
HumHub Change Log
=================
1.4.2
1.4.2 (Februrary 27, 2020)
--------------------------
- Fix #3865: "Use default swipe" setting not working
@ -12,6 +12,7 @@ HumHub Change Log
- Fix #3866: Emoji chooser broken after pjax link
- Enh: Added emoji richtext menu item
- Enh: Updated humhub richtext version to 1.0.20
- Fix #3883: Former & soft deleted LDAP user produces multiple warnings
1.4.1 (Februrary 17, 2020)

View File

@ -213,8 +213,8 @@ class LdapAuth extends BaseFormAuth implements AutoSyncUsers, SyncAttributes, Ap
* Find user based on ldap attributes
*
* @inheritdoc
* @see PrimaryClient
* @return User the user
* @see PrimaryClient
*/
public function getUser()
{
@ -510,7 +510,7 @@ class LdapAuth extends BaseFormAuth implements AutoSyncUsers, SyncAttributes, Ap
$user->status = User::STATUS_ENABLED;
$user->save();
Yii::info('Enabled user' . $user->username . ' (' . $user->id . ') - found in LDAP!', 'ldap');
} elseif (!$foundInLdap && $user->status !== User::STATUS_DISABLED) {
} elseif (!$foundInLdap && $user->status == User::STATUS_ENABLED) {
// Disable users that were not found in ldap
$user->status = User::STATUS_DISABLED;
$user->save();

View File

@ -0,0 +1,42 @@
<?php
use yii\db\Migration;
/**
* Class m200217_122108_profile_translation_fix
*/
class m200218_122109_profile_translation_fix2 extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->update('profile_field', ['translation_category' => 'UserModule.profile'], ['translation_category' => 'UserModule.models_Profile']);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m200217_122108_profile_translation_fix cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m200217_122108_profile_translation_fix cannot be reverted.\n";
return false;
}
*/
}

View File

@ -439,7 +439,8 @@ class User extends ContentContainerActiveRecord implements IdentityInterface, Se
$this->updateAttributes([
'email' => new Expression('NULL'),
'username' => 'deleted-' . $this->id,
'status' => User::STATUS_SOFT_DELETED
'status' => User::STATUS_SOFT_DELETED,
'authclient_id' => new Expression('NULL')
]);
return true;