Script: Cron: add possibility to empty an extra field when anonymizing a user -refs BT#21445

pull/5224/head
NicoDucou 2 years ago
parent 58d3647c90
commit 80df5b7d8c
  1. 6
      tests/scripts/synchronize_user_base_from_ldap.php

@ -51,7 +51,8 @@ $anonymizeUserAccountsDisbaledFor3Years = false;
//$extraLdapAttributes[0][] = 'description';
//$extraLdapAttributes[0][] = 'userAccountControl';
// Extra field to be emptied when user is anonimized to really make it anonyme, for example the sso id of the user
// extraFieldToEmpty = "cas_user";
use Chamilo\CoreBundle\Entity\ExtraFieldValues;
@ -478,6 +479,9 @@ if ($anonymizeUserAccountsDisbaledFor3Years) {
} catch (Exception $exception) {
die($exception->getMessage()."\n");
}
if (isset($extraFieldToEmpty)) {
UserManager::update_extra_field_value($userId,$extraFieldToEmpty,'');
}
}
if ($debug) {
echo "Anonymized user $userId\n";

Loading…
Cancel
Save