refactoring

This commit is contained in:
Roland Gruber 2025-07-30 07:37:12 +02:00
parent e52cfd54b6
commit 9ac2f2f621
11 changed files with 13 additions and 15 deletions

View file

@ -65,6 +65,7 @@ This is a list of API changes for all LAM releases.
<li>Module/Type API
<ul>
<li>Added defined parameter and return types to some methods (e.g. "getTitleBarSubtitle")</li>
<li>getPasswordQuickChangeOptions(): new parameter $forcePasswordChangeByDefault</li>
</ul>
</li>
</ul>

View file

@ -2422,9 +2422,10 @@ interface passwordService {
/**
* Returns a list of password quick change options.
*
* @param bool $forcePasswordChangeByDefault password change should be preselected
* @return PasswordQuickChangeOption[] options
*/
public function getPasswordQuickChangeOptions(): array;
public function getPasswordQuickChangeOptions(bool $forcePasswordChangeByDefault): array;
/**
* Returns a list of LDAP attribute changes to perform.

View file

@ -1273,7 +1273,7 @@ class asteriskAccount extends baseModule implements passwordService {
/**
* @inheritDoc
*/
public function getPasswordQuickChangeOptions(): array {
public function getPasswordQuickChangeOptions(bool $forcePasswordChangeByDefault): array {
$options = [];
if (in_array_ignore_case('AsteriskSIPUser', $this->attributes['objectClass'])) {
$options[] = new PasswordQuickChangeOption('syncAsterisk', _('Change Asterisk password'));

View file

@ -543,7 +543,7 @@ class asteriskVoicemail extends baseModule implements passwordService {
/**
* @inheritDoc
*/
public function getPasswordQuickChangeOptions(): array {
public function getPasswordQuickChangeOptions(bool $forcePasswordChangeByDefault): array {
$options = [];
if (in_array_ignore_case('AsteriskVoiceMail', $this->attributes['objectClass'])) {
$options[] = new PasswordQuickChangeOption('syncAsteriskVoiceMail', _('Change Asterisk voicemail password'));

View file

@ -3944,7 +3944,7 @@ class inetOrgPerson extends baseModule implements passwordService, AccountStatus
/**
* @inheritDoc
*/
public function getPasswordQuickChangeOptions(): array {
public function getPasswordQuickChangeOptions(bool $forcePasswordChangeByDefault): array {
if ($this->isUnixActive() && in_array_ignore_case('posixAccount', $this->attributes['objectClass'])) {
return [];
}

View file

@ -4215,7 +4215,7 @@ class posixAccount extends baseModule implements passwordService, AccountStatusP
/**
* @inheritDoc
*/
public function getPasswordQuickChangeOptions(): array {
public function getPasswordQuickChangeOptions(bool $forcePasswordChangeByDefault): array {
if (!in_array_ignore_case('posixAccount', $this->attributes['objectClass'])) {
return [];
}

View file

@ -1401,7 +1401,7 @@ class posixGroup extends baseModule implements passwordService {
/**
* @inheritDoc
*/
public function getPasswordQuickChangeOptions(): array {
public function getPasswordQuickChangeOptions(bool $forcePasswordChangeByDefault): array {
return [];
}

View file

@ -3,7 +3,6 @@
use LAM\REMOTE\Remote;
use LAM\TYPES\ConfiguredType;
use LDAP\Connection;
use function LAM\ACCOUNTLIST\isPasswordChangeByDefault;
/*
@ -2900,7 +2899,7 @@ class sambaSamAccount extends baseModule implements passwordService, AccountStat
/**
* @inheritDoc
*/
public function getPasswordQuickChangeOptions(): array {
public function getPasswordQuickChangeOptions(bool $forcePasswordChangeByDefault): array {
$options = [];
if (isset($this->attributes['sambaacctflags'][0])
&& (str_contains($this->attributes['sambaacctflags'][0], 'L')
@ -2909,7 +2908,7 @@ class sambaSamAccount extends baseModule implements passwordService, AccountStat
}
if (in_array_ignore_case('sambaSamAccount', $this->attributes['objectClass'])) {
$options[] = new PasswordQuickChangeOption('syncSambaNT', _('Change Samba NT password'));
$options[] = new PasswordQuickChangeOption('forcePasswordChangeSamba', _('Force Samba password change'), isPasswordChangeByDefault());
$options[] = new PasswordQuickChangeOption('forcePasswordChangeSamba', _('Force Samba password change'), $forcePasswordChangeByDefault);
}
if (isset($this->attributes['sambaPwdLastSet'][0])) {
$options[] = new PasswordQuickChangeOption('updateSambaTimestamps', _('Update Samba password timestamp'));

View file

@ -2,7 +2,6 @@
use LAM\JOB\AccountExpirationCleanupJob;
use LAM\JOB\PasswordExpirationJob;
use function LAM\ACCOUNTLIST\isPasswordChangeByDefault;
use LAM\TYPES\ConfiguredType;
/*
@ -892,10 +891,10 @@ class shadowAccount extends baseModule implements passwordService, AccountStatus
/**
* @inheritDoc
*/
public function getPasswordQuickChangeOptions(): array {
public function getPasswordQuickChangeOptions(bool $forcePasswordChangeByDefault): array {
$options = [];
if (in_array_ignore_case('shadowAccount', $this->attributes['objectClass'])) {
$options[] = new PasswordQuickChangeOption('forcePasswordChangeUnix', _('Force Unix password change'), isPasswordChangeByDefault());
$options[] = new PasswordQuickChangeOption('forcePasswordChangeUnix', _('Force Unix password change'), $forcePasswordChangeByDefault);
}
return $options;
}

View file

@ -4648,7 +4648,7 @@ class windowsUser extends baseModule implements passwordService, AccountStatusPr
/**
* @inheritDoc
*/
public function getPasswordQuickChangeOptions(): array {
public function getPasswordQuickChangeOptions(bool $forcePasswordChangeByDefault): array {
if (!in_array_ignore_case('user', $this->attributes['objectClass'])) {
return [];
}

View file

@ -15,8 +15,6 @@ parameters:
analyseAndScan:
- */lists/changePassword.php
ignoreErrors:
- '#Function [a-zA-Z0-9\\_-]+ not found.#'
- '#Used function [a-zA-Z0-9\\_-]+ not found.#'
- '#Variable \$helpArray might not be defined.#'
- '#Binary operation .* between .* and .* results in an error.#'
- '#Offset .SID. on array.*in isset\(\) always exists.*#'