diff --git a/src/QUI/ERP/Comments.php b/src/QUI/ERP/Comments.php index d8acbe79535b92cddfee3fe074b192036cfb6163..f6a6dc60d387967d442e85a5969cc0a44ffad882 100644 --- a/src/QUI/ERP/Comments.php +++ b/src/QUI/ERP/Comments.php @@ -8,7 +8,6 @@ use QUI; use QUI\ExceptionStack; -use QUI\Users\User; use function is_array; use function is_string; @@ -222,12 +221,12 @@ public function import(Comments $Comments): void /** * Get comments by user * - * @param User $User + * @param QUI\Interfaces\Users\User $User * @return Comments|null * * @throws ExceptionStack */ - public static function getCommentsByUser(QUI\Users\User $User): ?Comments + public static function getCommentsByUser(QUI\Interfaces\Users\User $User): ?Comments { $Comments = null; diff --git a/src/QUI/ERP/User.php b/src/QUI/ERP/User.php index b0555752ce51ba787c94c88e27ed90569451d516..5f50d040bb4b1329987819bdb4ee98f716f4bf9f 100644 --- a/src/QUI/ERP/User.php +++ b/src/QUI/ERP/User.php @@ -11,10 +11,10 @@ use QUI\ERP\Customer\NumberRange as CustomerNumberRange; use QUI\Groups\Group; use QUI\Interfaces\Users\User as UserInterface; +use QUI\Users\AuthenticatorInterface; use function array_filter; use function array_flip; -use function array_walk; use function explode; use function get_class; use function is_array; @@ -437,7 +437,7 @@ public function getType(): string /** * @return mixed */ - public function getStatus(): bool + public function getStatus(): int { return 0; } @@ -453,6 +453,12 @@ public function getAddress(int|string $id = 0): QUI\Users\Address return new Address($this->address, $this); } + public function getAddressList(): array + { + $Address = $this->getAddress(); + return [$Address->getUUID() => $Address]; + } + /** * @param QUI\Users\Address $Address */ @@ -464,7 +470,7 @@ public function setAddress(QUI\Users\Address $Address): void /** * @return Country|bool */ - public function getCountry(): QUI\Countries\Country|bool + public function getCountry(): ?QUI\Countries\Country { if (!empty($this->address) && isset($this->address['country'])) { try { @@ -558,16 +564,16 @@ public function canUseBackend(): bool /** * Does nothing */ - public function logout() + public function logout(): void { } /** * @param string $code - * @param User|UserInterface|null $PermissionUser + * @param UserInterface|null $PermissionUser * @return bool */ - public function activate(string $code, User|UserInterface|null $PermissionUser = null): bool + public function activate(string $code = '', ?QUI\Interfaces\Users\User $PermissionUser = null): bool { return true; } @@ -594,7 +600,7 @@ public function disable(UserInterface|null $PermissionUser = null): bool * Does nothing * @param UserInterface|null $PermissionUser */ - public function save(?UserInterface $PermissionUser = null) + public function save(?UserInterface $PermissionUser = null): void { } @@ -627,8 +633,9 @@ public function getStandardAddress(): Address return $this->getAddress(); } - public function addAddress(): void + public function addAddress(array $params = [], QUI\Interfaces\Users\User $ParentUser = null): ?Address { + return null; } /** @@ -679,11 +686,9 @@ public function getGroups(bool $array = true): array /** * This user has no avatar, it returned the default placeholder image * - * @return QUI\Projects\Media\Image|false - * * @throws QUI\Exception */ - public function getAvatar(): QUI\Projects\Media\Image|bool + public function getAvatar(): ?QUI\Projects\Media\Image { return QUI::getProjectManager() ->getStandard() @@ -700,6 +705,10 @@ public function setPassword(string $new, ?UserInterface $PermissionUser = null) { } + public function changePassword(string $newPassword, string $oldPassword, UserInterface $ParentUser = null): void + { + } + /** * Does nothing * @param string $pass @@ -801,4 +810,41 @@ public function getSupplierNo(): string } // endregion + + // region authenticator + public function hasAuthenticator(string $authenticator): bool + { + return false; + } + + public function getAuthenticators(): array + { + return []; + } + + public function getAuthenticator(string $authenticator): AuthenticatorInterface + { + throw new QUI\Users\Exception( + ['quiqqer/core', 'exception.authenticator.not.found'], + 404 + ); + } + + public function enableAuthenticator(string $authenticator, UserInterface $ParentUser = null): void + { + throw new QUI\Users\Exception( + ['quiqqer/core', 'exception.authenticator.not.found'], + 404 + ); + } + + public function disableAuthenticator(string $authenticator, UserInterface $ParentUser = null): void + { + throw new QUI\Users\Exception( + ['quiqqer/core', 'exception.authenticator.not.found'], + 404 + ); + } + + //endregion } diff --git a/src/QUI/ERP/Utils/User.php b/src/QUI/ERP/Utils/User.php index 646711739bba10c18a96e13daecdbd7e15479d6d..5aa44dbfb7250e8b0ce9af3db9403ba1049dc17c 100644 --- a/src/QUI/ERP/Utils/User.php +++ b/src/QUI/ERP/Utils/User.php @@ -274,7 +274,7 @@ public static function getUserArea(UserInterface $User): bool|QUI\ERP\Areas\Area * @return false|QUI\Users\Address * @throws QUI\Exception */ - public static function getUserERPAddress(UserInterface $User): bool|Address + public static function getUserERPAddress(UserInterface $User): null|Address { if (!QUI::getUsers()->isUser($User)) { throw new QUI\Exception([