Update VDM.Data.UsersSubform code

This commit is contained in:
Llewellyn 2024-09-10 22:00:24 +00:00
parent e432b291f4
commit 66cf997003

View File

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