dev #8

Merged
Llewellyn merged 3 commits from dev into master 2024-09-10 22:04:17 +00:00
Showing only changes of commit 66cf997003 - Show all commits

View File

@ -29,6 +29,14 @@
*/ */
protected array $user; protected array $user;
/**
* The current active user
*
* @var User
* @since 5.0.2
*/
protected User $identity;
/** /**
* The active users * The active users
* *
@ -53,6 +61,8 @@
$this->table = $table; $this->table = $table;
} }
$this->identity = Factory::getApplication()->getIdentity();
// Retrieve the user properties // Retrieve the user properties
$this->initializeUserProperties(); $this->initializeUserProperties();
} }
@ -397,7 +407,11 @@
{ {
$user = $this->loadUser($item, $activeUsers); $user = $this->loadUser($item, $activeUsers);
$details = $this->extractUserDetails($item, $user); $details = $this->extractUserDetails($item, $user);
$this->assignUserGroups($details, $user, $item);
if ($this->identity->id != $user->id)
{
$this->assignUserGroups($details, $user, $item);
}
return $this->saveUserDetails($details, $details['id'] ?? 0); return $this->saveUserDetails($details, $details['id'] ?? 0);
} }
@ -503,7 +517,7 @@
private function saveUserDetails(array $details, int $userId): int private function saveUserDetails(array $details, int $userId): int
{ {
try { try {
return UserHelper::save($details); return UserHelper::save($details, 0, ['useractivation' => 0, 'sendpassword' => 1, 'allowUserRegistration' => 1]);
} catch (NoUserIdFoundException $e) { } catch (NoUserIdFoundException $e) {
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error'); Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
} catch (\Exception $e) { } catch (\Exception $e) {