From 507a5d1fe2a9255422c014ea73c15c0f52458b4c Mon Sep 17 00:00:00 2001 From: Thibault Dockx <thibault.dockx@fusiondirectory.org> Date: Mon, 27 Jan 2025 21:31:42 +0000 Subject: [PATCH] :sparkles: Feat(supann) - enhancing general lock via core Enhancing general lock via core --- .../supann/class_supannAccountStatus.inc | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/supann/personal/supann/class_supannAccountStatus.inc b/supann/personal/supann/class_supannAccountStatus.inc index 320a99e5ce..7293cf1f61 100644 --- a/supann/personal/supann/class_supannAccountStatus.inc +++ b/supann/personal/supann/class_supannAccountStatus.inc @@ -209,15 +209,8 @@ class supannAccountStatus extends simplePlugin implements UserTabLockingAction { foreach ($this->supannRessourceEtatDate as $line) { list($label, $state, $substate, $start, $end) = $this->attributesAccess['supannRessourceEtatDate']->attribute->readValues($line); - - switch ($label) { - case 'COMPTE': - $this->processAccountState($state); - break; - - case 'MAIL': - $this->processMailState(); - break; + if ($label === 'COMPTE') { + $this->processAccountState($state); } } @@ -228,31 +221,20 @@ class supannAccountStatus extends simplePlugin implements UserTabLockingAction * @param string $state * @return void * Note : The concept of locking account is based on the modification of password hash. - * The passwordMethod class will trigger fillLockingLDAPAttrs methods of each plugins to lock what needs to be locked. + * The passwordMethod class will not trigger fillLockingLDAPAttrs methods of each plugin to lock everything. + * It only locked the account access by password modification - fillLockingLDAPAttrs is only available via general lock. */ protected function processAccountState(string $state): void { if ($state === 'A') { // Unlock account - userManagement::lockUser('unlock', $this->parent->getBaseObject()->userPassword, $this->dn); + userManagement::lockUser('unlock', $this->parent->getBaseObject()->userPassword, $this->dn, FALSE); } elseif (in_array($state, ['S', 'I'], true)) { // Lock account userManagement::lockUser('lock', $this->parent->getBaseObject()->userPassword, $this->dn); } } - /** - * @return void - * Part of the locking mechanism, this is for mail, the logic is within its plugin. At time of processing, the mail - * tab is not aware of supann change. Only upon user refresh will it notices and act upon it. Potentially locking its - * own resources or web services attached. (The change of attribute for another tab before save is tricky (v1.5). - */ - protected function processMailState(): void - { - // Refresh user info regardless of state - userManagement::refreshUserInfo($this->dn); - } - public function fillLockingLDAPAttrs (string $mode, array &$modify) { if (empty($this->supannRessourceEtatDate)) { -- GitLab