summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Auth.php18
-rw-r--r--app/Carbon.php5
-rw-r--r--app/Contracts/UserInterface.php28
-rw-r--r--app/GedcomRecord.php11
-rw-r--r--app/Http/Controllers/Admin/UsersController.php110
-rw-r--r--app/Http/Middleware/UseSession.php8
-rw-r--r--app/Http/RequestHandlers/AccountDelete.php5
-rw-r--r--app/Http/RequestHandlers/AccountEdit.php9
-rw-r--r--app/Http/RequestHandlers/AccountUpdate.php11
-rw-r--r--app/Http/RequestHandlers/EditMediaFileAction.php1
-rw-r--r--app/Http/RequestHandlers/LoginAction.php16
-rw-r--r--app/Http/RequestHandlers/ManageMediaPage.php4
-rw-r--r--app/Http/RequestHandlers/MergeFactsAction.php8
-rw-r--r--app/Http/RequestHandlers/MessageAction.php6
-rw-r--r--app/Http/RequestHandlers/MessagePage.php6
-rw-r--r--app/Http/RequestHandlers/RegisterAction.php32
-rw-r--r--app/Http/RequestHandlers/RenumberTreeAction.php6
-rw-r--r--app/Http/RequestHandlers/SelectLanguage.php3
-rw-r--r--app/Http/RequestHandlers/SelectTheme.php5
-rw-r--r--app/Http/RequestHandlers/SetupWizard.php14
-rw-r--r--app/Http/RequestHandlers/VerifyEmail.php13
-rw-r--r--app/Individual.php9
-rw-r--r--app/Module/BranchesListModule.php5
-rw-r--r--app/Module/ChartsBlockModule.php8
-rw-r--r--app/Module/IndividualListModule.php9
-rw-r--r--app/Module/ModuleThemeTrait.php8
-rw-r--r--app/Module/RelationshipsChartModule.php6
-rw-r--r--app/Module/ReviewChangesModule.php8
-rw-r--r--app/Module/UserMessagesModule.php6
-rw-r--r--app/Module/UserWelcomeModule.php6
-rw-r--r--app/Services/MessageService.php12
-rw-r--r--app/Services/TreeService.php10
-rw-r--r--app/Services/UserService.php32
-rw-r--r--app/Statistics/Repository/LatestUserRepository.php9
-rw-r--r--app/Statistics/Repository/UserRepository.php11
-rw-r--r--app/Tree.php18
-rw-r--r--app/User.php28
-rw-r--r--phpstan-baseline.neon5
-rw-r--r--resources/views/admin/users-cleanup.phtml5
-rw-r--r--resources/views/admin/users-edit.phtml25
-rw-r--r--resources/views/edit-account-page.phtml9
-rw-r--r--tests/app/Http/Middleware/AuthAdministratorTest.php5
-rw-r--r--tests/app/Http/Middleware/AuthEditorTest.php9
-rw-r--r--tests/app/Http/Middleware/AuthManagerTest.php9
-rw-r--r--tests/app/Http/Middleware/AuthMemberTest.php9
-rw-r--r--tests/app/Http/Middleware/AuthModeratorTest.php9
-rw-r--r--tests/app/Http/Middleware/CheckForMaintenanceModeTest.php3
-rw-r--r--tests/app/Http/RequestHandlers/AccountUpdateTest.php11
-rw-r--r--tests/app/Http/RequestHandlers/DeleteUserTest.php3
-rw-r--r--tests/app/Module/AhnentafelReportModuleTest.php6
-rw-r--r--tests/app/Module/BirthReportModuleTest.php6
-rw-r--r--tests/app/Module/CemeteryReportModuleTest.php6
-rw-r--r--tests/app/Module/ChangeReportModuleTest.php6
-rw-r--r--tests/app/Module/DeathReportModuleTest.php6
-rw-r--r--tests/app/Module/DescendancyReportModuleTest.php6
-rw-r--r--tests/app/Module/FactSourcesReportModuleTest.php6
-rw-r--r--tests/app/Module/FamilyGroupReportModuleTest.php6
-rw-r--r--tests/app/Module/IndividualFamiliesReportModuleTest.php6
-rw-r--r--tests/app/Module/IndividualReportModuleTest.php6
-rw-r--r--tests/app/Module/MarriageReportModuleTest.php6
-rw-r--r--tests/app/Module/MissingFactsReportModuleTest.php6
-rw-r--r--tests/app/Module/OccupationReportModuleTest.php6
-rw-r--r--tests/app/Module/PedigreeReportModuleTest.php6
-rw-r--r--tests/app/Module/RelatedIndividualsReportModuleTest.php6
-rw-r--r--tests/app/Services/UserServiceTest.php37
-rw-r--r--tests/app/TreeTest.php37
-rw-r--r--tests/feature/EmbeddedVariablesTest.php5
-rw-r--r--tests/feature/Privacy.php19
68 files changed, 395 insertions, 399 deletions
diff --git a/app/Auth.php b/app/Auth.php
index 34c5a5d5b8..4e35ec2a0b 100644
--- a/app/Auth.php
+++ b/app/Auth.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -70,7 +70,7 @@ class Auth
{
$user = $user ?? self::user();
- return $user->getPreference(User::PREF_IS_ADMINISTRATOR) === '1';
+ return $user->getPreference(UserInterface::PREF_IS_ADMINISTRATOR) === '1';
}
/**
@@ -85,7 +85,7 @@ class Auth
{
$user = $user ?? self::user();
- return self::isAdmin($user) || $tree->getUserPreference($user, User::PREF_TREE_ROLE) === User::ROLE_MANAGER;
+ return self::isAdmin($user) || $tree->getUserPreference($user, UserInterface::PREF_TREE_ROLE) === UserInterface::ROLE_MANAGER;
}
/**
@@ -100,7 +100,9 @@ class Auth
{
$user = $user ?? self::user();
- return self::isManager($tree, $user) || $tree->getUserPreference($user, User::PREF_TREE_ROLE) === User::ROLE_MODERATOR;
+ return
+ self::isManager($tree, $user) ||
+ $tree->getUserPreference($user, UserInterface::PREF_TREE_ROLE) === UserInterface::ROLE_MODERATOR;
}
/**
@@ -115,7 +117,9 @@ class Auth
{
$user = $user ?? self::user();
- return self::isModerator($tree, $user) || $tree->getUserPreference($user, User::PREF_TREE_ROLE) === 'edit';
+ return
+ self::isModerator($tree, $user) ||
+ $tree->getUserPreference($user, UserInterface::PREF_TREE_ROLE) === UserInterface::ROLE_EDITOR;
}
/**
@@ -130,7 +134,9 @@ class Auth
{
$user = $user ?? self::user();
- return self::isEditor($tree, $user) || $tree->getUserPreference($user, User::PREF_TREE_ROLE) === 'access';
+ return
+ self::isEditor($tree, $user) ||
+ $tree->getUserPreference($user, UserInterface::PREF_TREE_ROLE) === UserInterface::ROLE_MEMBER;
}
/**
diff --git a/app/Carbon.php b/app/Carbon.php
index 08f56061f9..d718a61b45 100644
--- a/app/Carbon.php
+++ b/app/Carbon.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees;
use Carbon\CarbonImmutable;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use function gregoriantojd;
@@ -48,7 +49,7 @@ class Carbon extends CarbonImmutable
*/
public function local(): Carbon
{
- $timezone = Auth::user()->getPreference(User::PREF_TIME_ZONE, Site::getPreference('TIMEZONE', 'UTC'));
+ $timezone = Auth::user()->getPreference(UserInterface::PREF_TIME_ZONE, Site::getPreference('TIMEZONE', 'UTC'));
// Changing locale does not create a new immutable object.
$this->locale(I18N::locale()->code());
diff --git a/app/Contracts/UserInterface.php b/app/Contracts/UserInterface.php
index a70e530f2e..60ddb84fe3 100644
--- a/app/Contracts/UserInterface.php
+++ b/app/Contracts/UserInterface.php
@@ -24,6 +24,34 @@ namespace Fisharebest\Webtrees\Contracts;
*/
interface UserInterface
{
+ // For historic reasons, user preferences have inconsistent and confusing names.
+ public const PREF_AUTO_ACCEPT_EDITS = 'auto_accept';
+ public const PREF_CONTACT_METHOD = 'contactmethod';
+ public const PREF_IS_ACCOUNT_APPROVED = 'verified_by_admin';
+ public const PREF_IS_ADMINISTRATOR = 'canadmin';
+ public const PREF_IS_EMAIL_VERIFIED = 'verified';
+ public const PREF_IS_VISIBLE_ONLINE = 'visibleonline';
+ public const PREF_LANGUAGE = 'language';
+ public const PREF_NEW_ACCOUNT_COMMENT = 'comment';
+ public const PREF_TIMESTAMP_REGISTERED = 'reg_timestamp';
+ public const PREF_TIMESTAMP_ACTIVE = 'sessiontime';
+ public const PREF_TIME_ZONE = 'TIMEZONE';
+ public const PREF_THEME = 'theme';
+ public const PREF_VERIFICATION_TOKEN = 'reg_hashcode';
+
+ // For historic reasons, user-tree preferences have inconsistent and confusing names.
+ public const PREF_TREE_ACCOUNT_XREF = 'gedcomid';
+ public const PREF_TREE_DEFAULT_XREF = 'rootid';
+ public const PREF_TREE_PATH_LENGTH = 'RELATIONSHIP_PATH_LENGTH';
+ public const PREF_TREE_ROLE = 'canedit';
+
+ // For historic reasons, roles have inconsistent and confusing names.
+ public const ROLE_VISITOR = 'none';
+ public const ROLE_MEMBER = 'access';
+ public const ROLE_EDITOR = 'edit';
+ public const ROLE_MODERATOR = 'accept';
+ public const ROLE_MANAGER = 'admin';
+
/**
* The user‘s internal identifier
*
diff --git a/app/GedcomRecord.php b/app/GedcomRecord.php
index c883c199b2..78b55b4e18 100644
--- a/app/GedcomRecord.php
+++ b/app/GedcomRecord.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -21,6 +21,7 @@ namespace Fisharebest\Webtrees;
use Closure;
use Exception;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
use Fisharebest\Webtrees\Http\RequestHandlers\GedcomRecordPage;
use Fisharebest\Webtrees\Services\PendingChangesService;
@@ -1001,7 +1002,7 @@ class GedcomRecord
$this->pending = $new_gedcom;
- if (Auth::user()->getPreference(User::PREF_AUTO_ACCEPT_EDITS) === '1') {
+ if (Auth::user()->getPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS) === '1') {
app(PendingChangesService::class)->acceptRecord($this);
$this->gedcom = $new_gedcom;
$this->pending = null;
@@ -1048,7 +1049,7 @@ class GedcomRecord
$this->pending = $gedcom;
// Accept this pending change
- if (Auth::user()->getPreference(User::PREF_AUTO_ACCEPT_EDITS) === '1') {
+ if (Auth::user()->getPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS) === '1') {
app(PendingChangesService::class)->acceptRecord($this);
$this->gedcom = $gedcom;
$this->pending = null;
@@ -1078,7 +1079,7 @@ class GedcomRecord
}
// Auto-accept this pending change
- if (Auth::user()->getPreference(User::PREF_AUTO_ACCEPT_EDITS) === '1') {
+ if (Auth::user()->getPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS) === '1') {
app(PendingChangesService::class)->acceptRecord($this);
}
@@ -1298,7 +1299,7 @@ class GedcomRecord
}
// We should always be able to see our own record (unless an admin is applying download restrictions)
- if ($this->xref() === $this->tree->getUserPreference(Auth::user(), User::PREF_TREE_ACCOUNT_XREF) && $access_level === Auth::accessLevel($this->tree)) {
+ if ($this->xref() === $this->tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF) && $access_level === Auth::accessLevel($this->tree)) {
return true;
}
diff --git a/app/Http/Controllers/Admin/UsersController.php b/app/Http/Controllers/Admin/UsersController.php
index 3bb23f1632..c2a42fb211 100644
--- a/app/Http/Controllers/Admin/UsersController.php
+++ b/app/Http/Controllers/Admin/UsersController.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -21,6 +21,7 @@ namespace Fisharebest\Webtrees\Http\Controllers\Admin;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Carbon;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Exceptions\HttpNotFoundException;
use Fisharebest\Webtrees\FlashMessages;
use Fisharebest\Webtrees\I18N;
@@ -38,7 +39,6 @@ use Fisharebest\Webtrees\SiteUser;
use Fisharebest\Webtrees\User;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Query\JoinClause;
-use Illuminate\Support\Collection;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use stdClass;
@@ -145,22 +145,22 @@ class UsersController extends AbstractAdminController
->leftJoin('user_setting AS us2', static function (JoinClause $join): void {
$join
->on('us2.user_id', '=', 'user.user_id')
- ->where('us2.setting_name', '=', User::PREF_TIMESTAMP_REGISTERED);
+ ->where('us2.setting_name', '=', UserInterface::PREF_TIMESTAMP_REGISTERED);
})
->leftJoin('user_setting AS us3', static function (JoinClause $join): void {
$join
->on('us3.user_id', '=', 'user.user_id')
- ->where('us3.setting_name', '=', User::PREF_TIMESTAMP_ACTIVE);
+ ->where('us3.setting_name', '=', UserInterface::PREF_TIMESTAMP_ACTIVE);
})
->leftJoin('user_setting AS us4', static function (JoinClause $join): void {
$join
->on('us4.user_id', '=', 'user.user_id')
- ->where('us4.setting_name', '=', User::PREF_IS_EMAIL_VERIFIED);
+ ->where('us4.setting_name', '=', UserInterface::PREF_IS_EMAIL_VERIFIED);
})
->leftJoin('user_setting AS us5', static function (JoinClause $join): void {
$join
->on('us5.user_id', '=', 'user.user_id')
- ->where('us5.setting_name', '=', User::PREF_IS_ACCOUNT_APPROVED);
+ ->where('us5.setting_name', '=', UserInterface::PREF_IS_ACCOUNT_APPROVED);
})
->where('user.user_id', '>', '0')
->select([
@@ -250,13 +250,31 @@ class UsersController extends AbstractAdminController
return [$locale->languageTag() => $locale->endonym()];
});
+ $roles = [
+ /* I18N: Listbox entry; name of a role */
+ UserInterface::ROLE_VISITOR => I18N::translate('Visitor'),
+ /* I18N: Listbox entry; name of a role */
+ UserInterface::ROLE_MEMBER => I18N::translate('Member'),
+ /* I18N: Listbox entry; name of a role */
+ UserInterface::ROLE_EDITOR => I18N::translate('Editor'),
+ /* I18N: Listbox entry; name of a role */
+ UserInterface::ROLE_MODERATOR => I18N::translate('Moderator'),
+ /* I18N: Listbox entry; name of a role */
+ UserInterface::ROLE_MANAGER => I18N::translate('Manager'),
+ ];
+
+ $theme_options = $this->module_service
+ ->findByInterface(ModuleThemeInterface::class)
+ ->map($this->module_service->titleMapper())
+ ->prepend(I18N::translate('<default theme>'), '');
+
return $this->viewResponse('admin/users-edit', [
'contact_methods' => $this->message_service->contactMethods(),
'default_language' => I18N::languageTag(),
'languages' => $languages->all(),
- 'roles' => $this->roles(),
+ 'roles' => $roles,
'trees' => $this->tree_service->all(),
- 'theme_options' => $this->themeOptions(),
+ 'theme_options' => $theme_options,
'title' => I18N::translate('Edit the user'),
'user' => $user,
]);
@@ -298,11 +316,11 @@ class UsersController extends AbstractAdminController
}
$new_user = $this->user_service->create($username, $real_name, $email, $password);
- $new_user->setPreference(User::PREF_IS_EMAIL_VERIFIED, '1');
- $new_user->setPreference(User::PREF_LANGUAGE, I18N::languageTag());
- $new_user->setPreference(User::PREF_TIME_ZONE, Site::getPreference('TIMEZONE', 'UTC'));
- $new_user->setPreference(User::PREF_TIMESTAMP_REGISTERED, date('U'));
- $new_user->setPreference(User::PREF_TIMESTAMP_ACTIVE, '0');
+ $new_user->setPreference(UserInterface::PREF_IS_EMAIL_VERIFIED, '1');
+ $new_user->setPreference(UserInterface::PREF_LANGUAGE, I18N::languageTag());
+ $new_user->setPreference(UserInterface::PREF_TIME_ZONE, Site::getPreference('TIMEZONE', 'UTC'));
+ $new_user->setPreference(UserInterface::PREF_TIMESTAMP_REGISTERED, date('U'));
+ $new_user->setPreference(UserInterface::PREF_TIMESTAMP_ACTIVE, '0');
Log::addAuthenticationLog('User ->' . $username . '<- created');
@@ -334,10 +352,10 @@ class UsersController extends AbstractAdminController
$timezone = $params['timezone'];
$contact_method = $params['contact-method'];
$comment = $params['comment'];
- $auto_accept = (bool) ($params[User::PREF_AUTO_ACCEPT_EDITS] ?? '');
- $canadmin = (bool) ($params[User::PREF_IS_ADMINISTRATOR] ?? '');
+ $auto_accept = (bool) ($params[UserInterface::PREF_AUTO_ACCEPT_EDITS] ?? '');
+ $canadmin = (bool) ($params[UserInterface::PREF_IS_ADMINISTRATOR] ?? '');
$visible_online = (bool) ($params['visible-online'] ?? '');
- $verified = (bool) ($params[User::PREF_IS_EMAIL_VERIFIED] ?? '');
+ $verified = (bool) ($params[UserInterface::PREF_IS_EMAIL_VERIFIED] ?? '');
$approved = (bool) ($params['approved'] ?? '');
$edit_user = $this->user_service->find($user_id);
@@ -347,8 +365,8 @@ class UsersController extends AbstractAdminController
}
// We have just approved a user. Tell them
- if ($approved && $edit_user->getPreference(User::PREF_IS_ACCOUNT_APPROVED) !== '1') {
- I18N::init($edit_user->getPreference(User::PREF_LANGUAGE));
+ if ($approved && $edit_user->getPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED) !== '1') {
+ I18N::init($edit_user->getPreference(UserInterface::PREF_LANGUAGE));
$base_url = $request->getAttribute('base_url');
@@ -364,15 +382,15 @@ class UsersController extends AbstractAdminController
}
$edit_user->setRealName($real_name);
- $edit_user->setPreference(User::PREF_THEME, $theme);
- $edit_user->setPreference(User::PREF_LANGUAGE, $language);
- $edit_user->setPreference(User::PREF_TIME_ZONE, $timezone);
- $edit_user->setPreference(User::PREF_CONTACT_METHOD, $contact_method);
- $edit_user->setPreference(User::PREF_NEW_ACCOUNT_COMMENT, $comment);
- $edit_user->setPreference(User::PREF_AUTO_ACCEPT_EDITS, (string) $auto_accept);
- $edit_user->setPreference(User::PREF_IS_VISIBLE_ONLINE, (string) $visible_online);
- $edit_user->setPreference(User::PREF_IS_EMAIL_VERIFIED, (string) $verified);
- $edit_user->setPreference(User::PREF_IS_ACCOUNT_APPROVED, (string) $approved);
+ $edit_user->setPreference(UserInterface::PREF_THEME, $theme);
+ $edit_user->setPreference(UserInterface::PREF_LANGUAGE, $language);
+ $edit_user->setPreference(UserInterface::PREF_TIME_ZONE, $timezone);
+ $edit_user->setPreference(UserInterface::PREF_CONTACT_METHOD, $contact_method);
+ $edit_user->setPreference(UserInterface::PREF_NEW_ACCOUNT_COMMENT, $comment);
+ $edit_user->setPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS, (string) $auto_accept);
+ $edit_user->setPreference(UserInterface::PREF_IS_VISIBLE_ONLINE, (string) $visible_online);
+ $edit_user->setPreference(UserInterface::PREF_IS_EMAIL_VERIFIED, (string) $verified);
+ $edit_user->setPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED, (string) $approved);
if ($password !== '') {
$edit_user->setPassword($password);
@@ -380,7 +398,7 @@ class UsersController extends AbstractAdminController
// We cannot change our own admin status. Another admin will need to do it.
if ($edit_user->id() !== $user->id()) {
- $edit_user->setPreference(User::PREF_IS_ADMINISTRATOR, $canadmin ? '1' : '');
+ $edit_user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, $canadmin ? '1' : '');
}
foreach ($this->tree_service->all() as $tree) {
@@ -393,9 +411,9 @@ class UsersController extends AbstractAdminController
$path_length = 0;
}
- $tree->setUserPreference($edit_user, User::PREF_TREE_ACCOUNT_XREF, $gedcom_id);
- $tree->setUserPreference($edit_user, User::PREF_TREE_ROLE, $can_edit);
- $tree->setUserPreference($edit_user, User::PREF_TREE_PATH_LENGTH, (string) $path_length);
+ $tree->setUserPreference($edit_user, UserInterface::PREF_TREE_ACCOUNT_XREF, $gedcom_id);
+ $tree->setUserPreference($edit_user, UserInterface::PREF_TREE_ROLE, $can_edit);
+ $tree->setUserPreference($edit_user, UserInterface::PREF_TREE_PATH_LENGTH, (string) $path_length);
}
if ($edit_user->email() !== $email && $this->user_service->findByEmail($email) instanceof User) {
@@ -416,34 +434,4 @@ class UsersController extends AbstractAdminController
return redirect(route('admin-users'));
}
-
- /**
- * @return string[]
- */
- private function roles(): array
- {
- return [
- /* I18N: Listbox entry; name of a role */
- User::ROLE_VISITOR => I18N::translate('Visitor'),
- /* I18N: Listbox entry; name of a role */
- User::ROLE_MEMBER => I18N::translate('Member'),
- /* I18N: Listbox entry; name of a role */
- User::ROLE_EDITOR => I18N::translate('Editor'),
- /* I18N: Listbox entry; name of a role */
- User::ROLE_MODERATOR => I18N::translate('Moderator'),
- /* I18N: Listbox entry; name of a role */
- User::ROLE_MANAGER => I18N::translate('Manager'),
- ];
- }
-
- /**
- * @return Collection<string>
- */
- private function themeOptions(): Collection
- {
- return $this->module_service
- ->findByInterface(ModuleThemeInterface::class)
- ->map($this->module_service->titleMapper())
- ->prepend(I18N::translate('<default theme>'), '');
- }
}
diff --git a/app/Http/Middleware/UseSession.php b/app/Http/Middleware/UseSession.php
index 3978c6bb71..a42e39c1d1 100644
--- a/app/Http/Middleware/UseSession.php
+++ b/app/Http/Middleware/UseSession.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -21,8 +21,8 @@ namespace Fisharebest\Webtrees\Http\Middleware;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Carbon;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Session;
-use Fisharebest\Webtrees\User;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
@@ -59,10 +59,10 @@ class UseSession implements MiddlewareInterface
// Update the last-login time no more than once a minute.
if (Session::get('masquerade') === null) {
- $last = Carbon::createFromTimestamp((int) $user->getPreference(User::PREF_TIMESTAMP_ACTIVE));
+ $last = Carbon::createFromTimestamp((int) $user->getPreference(UserInterface::PREF_TIMESTAMP_ACTIVE));
if (Carbon::now()->subMinute()->gt($last)) {
- $user->setPreference(User::PREF_TIMESTAMP_ACTIVE, (string) Carbon::now()->unix());
+ $user->setPreference(UserInterface::PREF_TIMESTAMP_ACTIVE, (string) Carbon::now()->unix());
}
}
diff --git a/app/Http/RequestHandlers/AccountDelete.php b/app/Http/RequestHandlers/AccountDelete.php
index c9214ec965..c18f58bacc 100644
--- a/app/Http/RequestHandlers/AccountDelete.php
+++ b/app/Http/RequestHandlers/AccountDelete.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\RequestHandlers;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
use Fisharebest\Webtrees\User;
@@ -59,7 +60,7 @@ class AccountDelete implements RequestHandlerInterface
$user = $request->getAttribute('user');
// An administrator can only be deleted by another administrator
- if ($user instanceof User && $user->getPreference(User::PREF_IS_ADMINISTRATOR) !== '1') {
+ if ($user instanceof User && $user->getPreference(UserInterface::PREF_IS_ADMINISTRATOR) !== '1') {
$this->user_service->delete($user);
Auth::logout();
}
diff --git a/app/Http/RequestHandlers/AccountEdit.php b/app/Http/RequestHandlers/AccountEdit.php
index 1def9422d7..55f7628182 100644
--- a/app/Http/RequestHandlers/AccountEdit.php
+++ b/app/Http/RequestHandlers/AccountEdit.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -21,6 +21,7 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers;
use DateTimeZone;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Http\ViewResponseTrait;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Module\ModuleLanguageInterface;
@@ -73,8 +74,8 @@ class AccountEdit implements RequestHandlerInterface
assert($user instanceof User);
if ($tree instanceof Tree) {
- $my_individual_record = Registry::individualFactory()->make($tree->getUserPreference(Auth::user(), User::PREF_TREE_ACCOUNT_XREF), $tree);
- $default_individual = Registry::individualFactory()->make($tree->getUserPreference(Auth::user(), User::PREF_TREE_DEFAULT_XREF), $tree);
+ $my_individual_record = Registry::individualFactory()->make($tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF), $tree);
+ $default_individual = Registry::individualFactory()->make($tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_DEFAULT_XREF), $tree);
} else {
$my_individual_record = null;
$default_individual = null;
@@ -87,7 +88,7 @@ class AccountEdit implements RequestHandlerInterface
return [$locale->languageTag() => $locale->endonym()];
});
- $show_delete_option = $user->getPreference(User::PREF_IS_ADMINISTRATOR) !== '1';
+ $show_delete_option = $user->getPreference(UserInterface::PREF_IS_ADMINISTRATOR) !== '1';
$timezone_ids = DateTimeZone::listIdentifiers();
$timezones = array_combine($timezone_ids, $timezone_ids);
$title = I18N::translate('My account');
diff --git a/app/Http/RequestHandlers/AccountUpdate.php b/app/Http/RequestHandlers/AccountUpdate.php
index 095527928b..1a789d3388 100644
--- a/app/Http/RequestHandlers/AccountUpdate.php
+++ b/app/Http/RequestHandlers/AccountUpdate.php
@@ -19,6 +19,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\RequestHandlers;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\FlashMessages;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Services\UserService;
@@ -97,14 +98,14 @@ class AccountUpdate implements RequestHandlerInterface
}
$user->setRealName($real_name);
- $user->setPreference(User::PREF_CONTACT_METHOD, $contact_method);
- $user->setPreference(User::PREF_LANGUAGE, $language);
- $user->setPreference(User::PREF_TIME_ZONE, $time_zone);
- $user->setPreference(User::PREF_IS_VISIBLE_ONLINE, $visible_online);
+ $user->setPreference(UserInterface::PREF_CONTACT_METHOD, $contact_method);
+ $user->setPreference(UserInterface::PREF_LANGUAGE, $language);
+ $user->setPreference(UserInterface::PREF_TIME_ZONE, $time_zone);
+ $user->setPreference(UserInterface::PREF_IS_VISIBLE_ONLINE, $visible_online);
if ($tree instanceof Tree) {
$default_xref = $params['default-xref'];
- $tree->setUserPreference($user, User::PREF_TREE_DEFAULT_XREF, $default_xref);
+ $tree->setUserPreference($user, UserInterface::PREF_TREE_DEFAULT_XREF, $default_xref);
}
// Switch to the new language now
diff --git a/app/Http/RequestHandlers/EditMediaFileAction.php b/app/Http/RequestHandlers/EditMediaFileAction.php
index d2ff66476e..f0d877a1c4 100644
--- a/app/Http/RequestHandlers/EditMediaFileAction.php
+++ b/app/Http/RequestHandlers/EditMediaFileAction.php
@@ -19,7 +19,6 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\RequestHandlers;
-use Exception;
use Fisharebest\Webtrees\FlashMessages;
use Fisharebest\Webtrees\Html;
use Fisharebest\Webtrees\I18N;
diff --git a/app/Http/RequestHandlers/LoginAction.php b/app/Http/RequestHandlers/LoginAction.php
index 8416fc461e..b42d9397eb 100644
--- a/app/Http/RequestHandlers/LoginAction.php
+++ b/app/Http/RequestHandlers/LoginAction.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -22,6 +22,7 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers;
use Exception;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Carbon;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\FlashMessages;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Log;
@@ -29,7 +30,6 @@ use Fisharebest\Webtrees\Services\UpgradeService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Session;
use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
@@ -127,22 +127,22 @@ class LoginAction implements RequestHandlerInterface
throw new Exception(I18N::translate('The username or password is incorrect.'));
}
- if ($user->getPreference(User::PREF_IS_EMAIL_VERIFIED) !== '1') {
+ if ($user->getPreference(UserInterface::PREF_IS_EMAIL_VERIFIED) !== '1') {
Log::addAuthenticationLog('Login failed (not verified by user): ' . $username);
throw new Exception(I18N::translate('This account has not been verified. Please check your email for a verification message.'));
}
- if ($user->getPreference(User::PREF_IS_ACCOUNT_APPROVED) !== '1') {
+ if ($user->getPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED) !== '1') {
Log::addAuthenticationLog('Login failed (not approved by admin): ' . $username);
throw new Exception(I18N::translate('This account has not been approved. Please wait for an administrator to approve it.'));
}
Auth::login($user);
Log::addAuthenticationLog('Login: ' . Auth::user()->userName() . '/' . Auth::user()->realName());
- Auth::user()->setPreference(User::PREF_TIMESTAMP_ACTIVE, (string) Carbon::now()->unix());
+ Auth::user()->setPreference(UserInterface::PREF_TIMESTAMP_ACTIVE, (string) Carbon::now()->unix());
- Session::put('language', Auth::user()->getPreference(User::PREF_LANGUAGE));
- Session::put('theme', Auth::user()->getPreference(User::PREF_THEME));
- I18N::init(Auth::user()->getPreference(User::PREF_LANGUAGE));
+ Session::put('language', Auth::user()->getPreference(UserInterface::PREF_LANGUAGE));
+ Session::put('theme', Auth::user()->getPreference(UserInterface::PREF_THEME));
+ I18N::init(Auth::user()->getPreference(UserInterface::PREF_LANGUAGE));
}
}
diff --git a/app/Http/RequestHandlers/ManageMediaPage.php b/app/Http/RequestHandlers/ManageMediaPage.php
index 7f21387c46..60817c5d36 100644
--- a/app/Http/RequestHandlers/ManageMediaPage.php
+++ b/app/Http/RequestHandlers/ManageMediaPage.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -22,9 +22,7 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers;
use Fisharebest\Webtrees\Http\ViewResponseTrait;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Registry;
-use Fisharebest\Webtrees\Services\DatatablesService;
use Fisharebest\Webtrees\Services\MediaFileService;
-use Fisharebest\Webtrees\Services\TreeService;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
diff --git a/app/Http/RequestHandlers/MergeFactsAction.php b/app/Http/RequestHandlers/MergeFactsAction.php
index 0fdd5a2d04..b0fa83cbca 100644
--- a/app/Http/RequestHandlers/MergeFactsAction.php
+++ b/app/Http/RequestHandlers/MergeFactsAction.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,11 +20,11 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\RequestHandlers;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\FlashMessages;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Query\Expression;
use Psr\Http\Message\ResponseInterface;
@@ -82,7 +82,7 @@ class MergeFactsAction implements RequestHandlerInterface
}
// If we are not auto-accepting, then we can show a link to the pending deletion
- if (Auth::user()->getPreference(User::PREF_AUTO_ACCEPT_EDITS) === '1') {
+ if (Auth::user()->getPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS) === '1') {
$record2_name = $record2->fullName();
} else {
$record2_name = '<a class="alert-link" href="' . e($record2->url()) . '">' . $record2->fullName() . '</a>';
@@ -112,7 +112,7 @@ class MergeFactsAction implements RequestHandlerInterface
// Update any linked user-accounts
DB::table('user_gedcom_setting')
->where('gedcom_id', '=', $tree->id())
- ->whereIn('setting_name', [User::PREF_TREE_ACCOUNT_XREF, User::PREF_TREE_DEFAULT_XREF])
+ ->whereIn('setting_name', [UserInterface::PREF_TREE_ACCOUNT_XREF, UserInterface::PREF_TREE_DEFAULT_XREF])
->where('setting_value', '=', $xref2)
->update(['setting_value' => $xref1]);
diff --git a/app/Http/RequestHandlers/MessageAction.php b/app/Http/RequestHandlers/MessageAction.php
index e2087c38e4..4229c0a76b 100644
--- a/app/Http/RequestHandlers/MessageAction.php
+++ b/app/Http/RequestHandlers/MessageAction.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -19,6 +19,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\RequestHandlers;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Exceptions\HttpAccessDeniedException;
use Fisharebest\Webtrees\FlashMessages;
use Fisharebest\Webtrees\Http\ViewResponseTrait;
@@ -26,7 +27,6 @@ use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Services\MessageService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
@@ -80,7 +80,7 @@ class MessageAction implements RequestHandlerInterface
$to_user = $this->user_service->findByUserName($to);
$ip = $request->getAttribute('client-ip');
- if ($to_user === null || $to_user->getPreference(User::PREF_CONTACT_METHOD) === 'none') {
+ if ($to_user === null || $to_user->getPreference(UserInterface::PREF_CONTACT_METHOD) === 'none') {
throw new HttpAccessDeniedException('Invalid contact user id');
}
diff --git a/app/Http/RequestHandlers/MessagePage.php b/app/Http/RequestHandlers/MessagePage.php
index 929c4cbf59..2c8401dc48 100644
--- a/app/Http/RequestHandlers/MessagePage.php
+++ b/app/Http/RequestHandlers/MessagePage.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -19,12 +19,12 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\RequestHandlers;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Exceptions\HttpAccessDeniedException;
use Fisharebest\Webtrees\Http\ViewResponseTrait;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
@@ -69,7 +69,7 @@ class MessagePage implements RequestHandlerInterface
$url = $request->getQueryParams()['url'] ?? route(HomePage::class);
$to_user = $this->user_service->findByUserName($to);
- if ($to_user === null || $to_user->getPreference(User::PREF_CONTACT_METHOD) === 'none') {
+ if ($to_user === null || $to_user->getPreference(UserInterface::PREF_CONTACT_METHOD) === 'none') {
throw new HttpAccessDeniedException('Invalid contact user id');
}
diff --git a/app/Http/RequestHandlers/RegisterAction.php b/app/Http/RequestHandlers/RegisterAction.php
index da1a82f729..b6b5fe6202 100644
--- a/app/Http/RequestHandlers/RegisterAction.php
+++ b/app/Http/RequestHandlers/RegisterAction.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\RequestHandlers;
use Exception;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Exceptions\HttpNotFoundException;
use Fisharebest\Webtrees\FlashMessages;
use Fisharebest\Webtrees\Http\ViewResponseTrait;
@@ -33,7 +34,6 @@ use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\SiteUser;
use Fisharebest\Webtrees\Tree;
use Fisharebest\Webtrees\TreeUser;
-use Fisharebest\Webtrees\User;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Support\Str;
use Psr\Http\Message\ResponseInterface;
@@ -118,18 +118,18 @@ class RegisterAction implements RequestHandlerInterface
$user = $this->user_service->create($username, $realname, $email, $password);
$token = Str::random(32);
- $user->setPreference(User::PREF_LANGUAGE, I18N::languageTag());
- $user->setPreference(User::PREF_TIME_ZONE, Site::getPreference('TIMEZONE', 'UTC'));
- $user->setPreference(User::PREF_IS_EMAIL_VERIFIED, '');
- $user->setPreference(User::PREF_IS_ACCOUNT_APPROVED, '');
- $user->setPreference(User::PREF_TIMESTAMP_REGISTERED, date('U'));
- $user->setPreference(User::PREF_VERIFICATION_TOKEN, $token);
- $user->setPreference(User::PREF_CONTACT_METHOD, 'messaging2');
- $user->setPreference(User::PREF_NEW_ACCOUNT_COMMENT, $comment);
- $user->setPreference(User::PREF_IS_VISIBLE_ONLINE, '1');
- $user->setPreference(User::PREF_AUTO_ACCEPT_EDITS, '');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '');
- $user->setPreference(User::PREF_TIMESTAMP_ACTIVE, '0');
+ $user->setPreference(UserInterface::PREF_LANGUAGE, I18N::languageTag());
+ $user->setPreference(UserInterface::PREF_TIME_ZONE, Site::getPreference('TIMEZONE', 'UTC'));
+ $user->setPreference(UserInterface::PREF_IS_EMAIL_VERIFIED, '');
+ $user->setPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED, '');
+ $user->setPreference(UserInterface::PREF_TIMESTAMP_REGISTERED, date('U'));
+ $user->setPreference(UserInterface::PREF_VERIFICATION_TOKEN, $token);
+ $user->setPreference(UserInterface::PREF_CONTACT_METHOD, 'messaging2');
+ $user->setPreference(UserInterface::PREF_NEW_ACCOUNT_COMMENT, $comment);
+ $user->setPreference(UserInterface::PREF_IS_VISIBLE_ONLINE, '1');
+ $user->setPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS, '');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '');
+ $user->setPreference(UserInterface::PREF_TIMESTAMP_ACTIVE, '0');
$base_url = $request->getAttribute('base_url');
$reply_to = $tree instanceof Tree ? new TreeUser($tree) : new SiteUser();
@@ -153,7 +153,7 @@ class RegisterAction implements RequestHandlerInterface
// Tell the administrators about the registration.
foreach ($this->user_service->administrators() as $administrator) {
- I18N::init($administrator->getPreference(User::PREF_LANGUAGE));
+ I18N::init($administrator->getPreference(UserInterface::PREF_LANGUAGE));
/* I18N: %s is a server name/URL */
$subject = I18N::translate('New registration at %s', $base_url);
@@ -183,7 +183,7 @@ class RegisterAction implements RequestHandlerInterface
$body_html
);
- $mail1_method = $administrator->getPreference(User::PREF_CONTACT_METHOD);
+ $mail1_method = $administrator->getPreference(UserInterface::PREF_CONTACT_METHOD);
if ($mail1_method !== 'messaging3' && $mail1_method !== 'mailto' && $mail1_method !== 'none') {
DB::table('message')->insert([
'sender' => $user->email(),
diff --git a/app/Http/RequestHandlers/RenumberTreeAction.php b/app/Http/RequestHandlers/RenumberTreeAction.php
index 846cab91e0..6602baea04 100644
--- a/app/Http/RequestHandlers/RenumberTreeAction.php
+++ b/app/Http/RequestHandlers/RenumberTreeAction.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -19,6 +19,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\RequestHandlers;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Family;
use Fisharebest\Webtrees\FlashMessages;
use Fisharebest\Webtrees\I18N;
@@ -31,7 +32,6 @@ use Fisharebest\Webtrees\Services\AdminService;
use Fisharebest\Webtrees\Services\TimeoutService;
use Fisharebest\Webtrees\Source;
use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Query\JoinClause;
@@ -153,7 +153,7 @@ class RenumberTreeAction implements RequestHandlerInterface
DB::table('user_gedcom_setting')
->where('gedcom_id', '=', $tree->id())
->where('setting_value', '=', $old_xref)
- ->whereIn('setting_name', [User::PREF_TREE_ACCOUNT_XREF, User::PREF_TREE_DEFAULT_XREF])
+ ->whereIn('setting_name', [UserInterface::PREF_TREE_ACCOUNT_XREF, UserInterface::PREF_TREE_DEFAULT_XREF])
->update([
'setting_value' => $new_xref,
]);
diff --git a/app/Http/RequestHandlers/SelectLanguage.php b/app/Http/RequestHandlers/SelectLanguage.php
index b86e8636bd..bdaa0ea4d4 100644
--- a/app/Http/RequestHandlers/SelectLanguage.php
+++ b/app/Http/RequestHandlers/SelectLanguage.php
@@ -21,7 +21,6 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers;
use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Session;
-use Fisharebest\Webtrees\User;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
@@ -49,7 +48,7 @@ class SelectLanguage implements RequestHandlerInterface
assert(is_string($language));
Session::put('language', $language);
- $user->setPreference(User::PREF_LANGUAGE, $language);
+ $user->setPreference(UserInterface::PREF_LANGUAGE, $language);
return response();
}
diff --git a/app/Http/RequestHandlers/SelectTheme.php b/app/Http/RequestHandlers/SelectTheme.php
index cfdbd3c7ee..3a034babc8 100644
--- a/app/Http/RequestHandlers/SelectTheme.php
+++ b/app/Http/RequestHandlers/SelectTheme.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -21,7 +21,6 @@ namespace Fisharebest\Webtrees\Http\RequestHandlers;
use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Session;
-use Fisharebest\Webtrees\User;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
@@ -49,7 +48,7 @@ class SelectTheme implements RequestHandlerInterface
assert(is_string($theme));
Session::put('theme', $theme);
- $user->setPreference(User::PREF_THEME, $theme);
+ $user->setPreference(UserInterface::PREF_THEME, $theme);
return response();
}
diff --git a/app/Http/RequestHandlers/SetupWizard.php b/app/Http/RequestHandlers/SetupWizard.php
index 92f09cbf04..af836bef14 100644
--- a/app/Http/RequestHandlers/SetupWizard.php
+++ b/app/Http/RequestHandlers/SetupWizard.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -25,6 +25,7 @@ use Fisharebest\Localization\Locale\LocaleEnUs;
use Fisharebest\Localization\Locale\LocaleInterface;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Cache;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Factories\CacheFactory;
use Fisharebest\Webtrees\Http\ViewResponseTrait;
use Fisharebest\Webtrees\I18N;
@@ -35,7 +36,6 @@ use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\ServerCheckService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Session;
-use Fisharebest\Webtrees\User;
use Fisharebest\Webtrees\Webtrees;
use Illuminate\Database\Capsule\Manager as DB;
use Psr\Http\Message\ResponseInterface;
@@ -405,15 +405,15 @@ class SetupWizard implements RequestHandlerInterface
// Create the user
if ($admin === null) {
$admin = $this->user_service->create($data['wtuser'], $data['wtname'], $data['wtemail'], $data['wtpass']);
- $admin->setPreference(User::PREF_LANGUAGE, $data['lang']);
- $admin->setPreference(User::PREF_IS_VISIBLE_ONLINE, '1');
+ $admin->setPreference(UserInterface::PREF_LANGUAGE, $data['lang']);
+ $admin->setPreference(UserInterface::PREF_IS_VISIBLE_ONLINE, '1');
} else {
$admin->setPassword($_POST['wtpass']);
}
// Make the user an administrator
- $admin->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
- $admin->setPreference(User::PREF_IS_EMAIL_VERIFIED, '1');
- $admin->setPreference(User::PREF_IS_ACCOUNT_APPROVED, '1');
+ $admin->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
+ $admin->setPreference(UserInterface::PREF_IS_EMAIL_VERIFIED, '1');
+ $admin->setPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED, '1');
// Write the config file. We already checked that this would work.
$config_ini_php = view('setup/config.ini', $data);
diff --git a/app/Http/RequestHandlers/VerifyEmail.php b/app/Http/RequestHandlers/VerifyEmail.php
index 2aac7e9f2c..e9e0875906 100644
--- a/app/Http/RequestHandlers/VerifyEmail.php
+++ b/app/Http/RequestHandlers/VerifyEmail.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -19,6 +19,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\RequestHandlers;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Http\ViewResponseTrait;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Log;
@@ -74,12 +75,12 @@ class VerifyEmail implements RequestHandlerInterface
$user = $this->user_service->findByUserName($username);
- if ($user instanceof User && $user->getPreference(User::PREF_VERIFICATION_TOKEN) === $token) {
+ if ($user instanceof User && $user->getPreference(UserInterface::PREF_VERIFICATION_TOKEN) === $token) {
$old_language = I18N::languageTag();
foreach ($this->user_service->administrators() as $administrator) {
// switch language to administrator settings
- I18N::init($administrator->getPreference(User::PREF_LANGUAGE));
+ I18N::init($administrator->getPreference(UserInterface::PREF_LANGUAGE));
$base_url = $request->getAttribute('base_url');
@@ -109,9 +110,9 @@ class VerifyEmail implements RequestHandlerInterface
}
I18N::init($old_language);
- $user->setPreference(User::PREF_IS_EMAIL_VERIFIED, '1');
- $user->setPreference(User::PREF_TIMESTAMP_REGISTERED, date('U'));
- $user->setPreference(User::PREF_VERIFICATION_TOKEN, '');
+ $user->setPreference(UserInterface::PREF_IS_EMAIL_VERIFIED, '1');
+ $user->setPreference(UserInterface::PREF_TIMESTAMP_REGISTERED, date('U'));
+ $user->setPreference(UserInterface::PREF_VERIFICATION_TOKEN, '');
Log::addAuthenticationLog('User ' . $username . ' verified their email address');
diff --git a/app/Individual.php b/app/Individual.php
index b5eed42f64..18ef23b6b8 100644
--- a/app/Individual.php
+++ b/app/Individual.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -21,6 +21,7 @@ namespace Fisharebest\Webtrees;
use Closure;
use Fisharebest\ExtCalendar\GregorianCalendar;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Http\RequestHandlers\IndividualPage;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Support\Collection;
@@ -180,8 +181,8 @@ class Individual extends GedcomRecord
}
}
// Consider relationship privacy (unless an admin is applying download restrictions)
- $user_path_length = (int) $this->tree->getUserPreference(Auth::user(), User::PREF_TREE_PATH_LENGTH);
- $gedcomid = $this->tree->getUserPreference(Auth::user(), User::PREF_TREE_ACCOUNT_XREF);
+ $user_path_length = (int) $this->tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_PATH_LENGTH);
+ $gedcomid = $this->tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF);
if ($gedcomid !== '' && $user_path_length > 0) {
return self::isRelated($this, $user_path_length);
@@ -203,7 +204,7 @@ class Individual extends GedcomRecord
{
static $cache = null;
- $user_individual = Registry::individualFactory()->make($target->tree->getUserPreference(Auth::user(), User::PREF_TREE_ACCOUNT_XREF), $target->tree);
+ $user_individual = Registry::individualFactory()->make($target->tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF), $target->tree);
if ($user_individual) {
if (!$cache) {
$cache = [
diff --git a/app/Module/BranchesListModule.php b/app/Module/BranchesListModule.php
index 67ac50fd70..27e6260cc8 100644
--- a/app/Module/BranchesListModule.php
+++ b/app/Module/BranchesListModule.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -32,7 +32,6 @@ use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Soundex;
use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Query\Builder;
use Illuminate\Database\Query\JoinClause;
@@ -201,7 +200,7 @@ class BranchesListModule extends AbstractModule implements ModuleListInterface,
$this->layout = 'layouts/ajax';
// Highlight direct-line ancestors of this individual.
- $xref = $tree->getUserPreference($user, User::PREF_TREE_ACCOUNT_XREF);
+ $xref = $tree->getUserPreference($user, UserInterface::PREF_TREE_ACCOUNT_XREF);
$self = Registry::individualFactory()->make($xref, $tree);
if ($surname !== '') {
diff --git a/app/Module/ChartsBlockModule.php b/app/Module/ChartsBlockModule.php
index 4c3997955e..aa06943d3b 100644
--- a/app/Module/ChartsBlockModule.php
+++ b/app/Module/ChartsBlockModule.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,13 +20,13 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Module\InteractiveTree\TreeView;
use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use Illuminate\Support\Str;
use Psr\Http\Message\ServerRequestInterface;
@@ -93,7 +93,7 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface
public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
{
$PEDIGREE_ROOT_ID = $tree->getPreference('PEDIGREE_ROOT_ID');
- $gedcomid = $tree->getUserPreference(Auth::user(), User::PREF_TREE_ACCOUNT_XREF);
+ $gedcomid = $tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF);
$default_xref = $gedcomid ?: $PEDIGREE_ROOT_ID;
$type = $this->getBlockSetting($block_id, 'type', 'pedigree');
@@ -261,7 +261,7 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface
public function editBlockConfiguration(Tree $tree, int $block_id): string
{
$PEDIGREE_ROOT_ID = $tree->getPreference('PEDIGREE_ROOT_ID');
- $gedcomid = $tree->getUserPreference(Auth::user(), User::PREF_TREE_ACCOUNT_XREF);
+ $gedcomid = $tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF);
$default_xref = $gedcomid ?: $PEDIGREE_ROOT_ID;
$type = $this->getBlockSetting($block_id, 'type', 'pedigree');
diff --git a/app/Module/IndividualListModule.php b/app/Module/IndividualListModule.php
index 0397e10fcc..867f353e99 100644
--- a/app/Module/IndividualListModule.php
+++ b/app/Module/IndividualListModule.php
@@ -662,21 +662,16 @@ class IndividualListModule extends AbstractModule implements ModuleListInterface
->orderBy('initial')
->pluck(new Expression('COUNT(*) AS aggregate'), new Expression('UPPER(SUBSTR(n_givn, 1, 1)) AS initial'));
- $specials = ['@'];
-
foreach ($rows as $alpha => $count) {
if ($alpha !== '@') {
$alphas[$alpha] = (int) $count;
}
}
- foreach ($specials as $special) {
- if ($rows->has('@')) {
- $alphas['@'] = (int) $rows['@'];
- }
+ if ($rows->has('@')) {
+ $alphas['@'] = (int) $rows['@'];
}
-
return $alphas;
}
diff --git a/app/Module/ModuleThemeTrait.php b/app/Module/ModuleThemeTrait.php
index e34de0513a..e8d9bf962e 100644
--- a/app/Module/ModuleThemeTrait.php
+++ b/app/Module/ModuleThemeTrait.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -21,6 +21,7 @@ namespace Fisharebest\Webtrees\Module;
use Aura\Router\Route;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Fact;
use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\Gedcom;
@@ -42,7 +43,6 @@ use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Menu;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use Psr\Http\Message\ServerRequestInterface;
use function app;
@@ -328,7 +328,7 @@ trait ModuleThemeTrait
*/
public function menuMyIndividualRecord(Tree $tree): ?Menu
{
- $record = Registry::individualFactory()->make($tree->getUserPreference(Auth::user(), User::PREF_TREE_ACCOUNT_XREF), $tree);
+ $record = Registry::individualFactory()->make($tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF), $tree);
if ($record) {
return new Menu(I18N::translate('My individual record'), $record->url(), 'menu-myrecord');
@@ -385,7 +385,7 @@ trait ModuleThemeTrait
*/
public function menuMyPedigree(Tree $tree): ?Menu
{
- $gedcomid = $tree->getUserPreference(Auth::user(), User::PREF_TREE_ACCOUNT_XREF);
+ $gedcomid = $tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF);
$pedigree_chart = app(ModuleService::class)->findByComponent(ModuleChartInterface::class, $tree, Auth::user())
->filter(static function (ModuleInterface $module): bool {
diff --git a/app/Module/RelationshipsChartModule.php b/app/Module/RelationshipsChartModule.php
index a3cb3597f6..5d086f4e3f 100644
--- a/app/Module/RelationshipsChartModule.php
+++ b/app/Module/RelationshipsChartModule.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -24,6 +24,7 @@ use Closure;
use Fig\Http\Message\RequestMethodInterface;
use Fisharebest\Algorithm\Dijkstra;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\FlashMessages;
use Fisharebest\Webtrees\Functions\Functions;
@@ -32,7 +33,6 @@ use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Menu;
use Fisharebest\Webtrees\Services\TreeService;
use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Query\JoinClause;
use Psr\Http\Message\ResponseInterface;
@@ -131,7 +131,7 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte
*/
public function chartMenu(Individual $individual): Menu
{
- $gedcomid = $individual->tree()->getUserPreference(Auth::user(), User::PREF_TREE_ACCOUNT_XREF);
+ $gedcomid = $individual->tree()->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF);
if ($gedcomid !== '' && $gedcomid !== $individual->xref()) {
return new Menu(
diff --git a/app/Module/ReviewChangesModule.php b/app/Module/ReviewChangesModule.php
index 9f0e5e3ada..5eca20cb37 100644
--- a/app/Module/ReviewChangesModule.php
+++ b/app/Module/ReviewChangesModule.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -21,6 +21,7 @@ namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Carbon;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\Http\RequestHandlers\PendingChanges;
use Fisharebest\Webtrees\I18N;
@@ -31,7 +32,6 @@ use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\SiteUser;
use Fisharebest\Webtrees\Tree;
use Fisharebest\Webtrees\TreeUser;
-use Fisharebest\Webtrees\User;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Support\Str;
use Psr\Http\Message\ServerRequestInterface;
@@ -122,10 +122,10 @@ class ReviewChangesModule extends AbstractModule implements ModuleBlockInterface
if ($next_email_timestamp < Carbon::now()) {
// Which users have pending changes?
foreach ($this->user_service->all() as $user) {
- if ($user->getPreference(User::PREF_CONTACT_METHOD) !== 'none') {
+ if ($user->getPreference(UserInterface::PREF_CONTACT_METHOD) !== 'none') {
foreach ($this->tree_service->all() as $tmp_tree) {
if ($tmp_tree->hasPendingEdit() && Auth::isManager($tmp_tree, $user)) {
- I18N::init($user->getPreference(User::PREF_LANGUAGE));
+ I18N::init($user->getPreference(UserInterface::PREF_LANGUAGE));
$this->email_service->send(
new SiteUser(),
diff --git a/app/Module/UserMessagesModule.php b/app/Module/UserMessagesModule.php
index 0590b39098..cbacda7371 100644
--- a/app/Module/UserMessagesModule.php
+++ b/app/Module/UserMessagesModule.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -145,9 +145,9 @@ class UserMessagesModule extends AbstractModule implements ModuleBlockInterface
return
$user->id() !== Auth::id() &&
- $user->getPreference(User::PREF_IS_ACCOUNT_APPROVED) &&
+ $user->getPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED) &&
$can_see_tree &&
- $user->getPreference(User::PREF_CONTACT_METHOD) !== 'none';
+ $user->getPreference(UserInterface::PREF_CONTACT_METHOD) !== 'none';
});
$content = '';
diff --git a/app/Module/UserWelcomeModule.php b/app/Module/UserWelcomeModule.php
index 879446cb24..deddb0f791 100644
--- a/app/Module/UserWelcomeModule.php
+++ b/app/Module/UserWelcomeModule.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,13 +20,13 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\Http\RequestHandlers\AccountEdit;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use Illuminate\Support\Str;
/**
@@ -85,7 +85,7 @@ class UserWelcomeModule extends AbstractModule implements ModuleBlockInterface
*/
public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
{
- $gedcomid = $tree->getUserPreference(Auth::user(), User::PREF_TREE_ACCOUNT_XREF);
+ $gedcomid = $tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF);
$individual = Registry::individualFactory()->make($gedcomid, $tree);
$links = [];
diff --git a/app/Services/MessageService.php b/app/Services/MessageService.php
index c51fd041b0..4c21e124fc 100644
--- a/app/Services/MessageService.php
+++ b/app/Services/MessageService.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -91,7 +91,7 @@ class MessageService
// Temporarily switch to the recipient's language
$old_language = I18N::languageTag();
- I18N::init($recipient->getPreference(User::PREF_LANGUAGE));
+ I18N::init($recipient->getPreference(UserInterface::PREF_LANGUAGE));
$body_text = view('emails/message-user-text', [
'sender' => $sender,
@@ -144,7 +144,7 @@ class MessageService
*/
public function sendInternalMessage(UserInterface $user): bool
{
- return in_array($user->getPreference(User::PREF_CONTACT_METHOD), [
+ return in_array($user->getPreference(UserInterface::PREF_CONTACT_METHOD), [
'messaging',
'messaging2',
'mailto',
@@ -161,7 +161,7 @@ class MessageService
*/
public function sendEmail(UserInterface $user): bool
{
- return in_array($user->getPreference(User::PREF_CONTACT_METHOD), [
+ return in_array($user->getPreference(UserInterface::PREF_CONTACT_METHOD), [
'messaging2',
'messaging3',
'mailto',
@@ -184,13 +184,13 @@ class MessageService
return $this->user_service->all();
case 'never_logged':
return $this->user_service->all()->filter(static function (UserInterface $user): bool {
- return $user->getPreference(User::PREF_IS_ACCOUNT_APPROVED) === '1' && $user->getPreference(User::PREF_TIMESTAMP_REGISTERED) > $user->getPreference(User::PREF_TIMESTAMP_ACTIVE);
+ return $user->getPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED) === '1' && $user->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERED) > $user->getPreference(UserInterface::PREF_TIMESTAMP_ACTIVE);
});
case 'last_6mo':
$six_months_ago = Carbon::now()->subMonths(6)->unix();
return $this->user_service->all()->filter(static function (UserInterface $user) use ($six_months_ago): bool {
- $session_time = (int) $user->getPreference(User::PREF_TIMESTAMP_ACTIVE);
+ $session_time = (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_ACTIVE);
return $session_time > 0 && $session_time < $six_months_ago;
});
diff --git a/app/Services/TreeService.php b/app/Services/TreeService.php
index 8e7a72312b..3a5301ff15 100644
--- a/app/Services/TreeService.php
+++ b/app/Services/TreeService.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,12 +20,12 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Services;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\Functions\FunctionsImport;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Site;
use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Query\Builder;
use Illuminate\Database\Query\Expression;
@@ -88,18 +88,18 @@ class TreeService
->leftJoin('user_gedcom_setting', static function (JoinClause $join): void {
$join->on('user_gedcom_setting.gedcom_id', '=', 'gedcom.gedcom_id')
->where('user_gedcom_setting.user_id', '=', Auth::id())
- ->where('user_gedcom_setting.setting_name', '=', User::PREF_TREE_ROLE);
+ ->where('user_gedcom_setting.setting_name', '=', UserInterface::PREF_TREE_ROLE);
})
->where(static function (Builder $query): void {
$query
// Managers
- ->where('user_gedcom_setting.setting_value', '=', User::ROLE_MANAGER)
+ ->where('user_gedcom_setting.setting_value', '=', UserInterface::ROLE_MANAGER)
// Members
->orWhere(static function (Builder $query): void {
$query
->where('gs2.setting_value', '=', '1')
->where('gs3.setting_value', '=', '1')
- ->where('user_gedcom_setting.setting_value', '<>', User::ROLE_VISITOR);
+ ->where('user_gedcom_setting.setting_value', '<>', UserInterface::ROLE_VISITOR);
})
// Public trees
->orWhere(static function (Builder $query): void {
diff --git a/app/Services/UserService.php b/app/Services/UserService.php
index 6c21f7055a..bea04bbfa9 100644
--- a/app/Services/UserService.php
+++ b/app/Services/UserService.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -107,7 +107,7 @@ class UserService
->join('user_gedcom_setting', 'user_gedcom_setting.user_id', '=', 'user.user_id')
->where('gedcom_id', '=', $individual->tree()->id())
->where('setting_value', '=', $individual->xref())
- ->where('setting_name', '=', User::PREF_TREE_ACCOUNT_XREF)
+ ->where('setting_name', '=', UserInterface::PREF_TREE_ACCOUNT_XREF)
->select(['user.*'])
->get()
->map(User::rowMapper());
@@ -159,10 +159,10 @@ class UserService
public function sortByLastLogin(): Closure
{
return static function (UserInterface $user1, UserInterface $user2) {
- $registered_at1 = (int) $user1->getPreference(User::PREF_TIMESTAMP_REGISTERED);
- $logged_in_at1 = (int) $user1->getPreference(User::PREF_TIMESTAMP_ACTIVE);
- $registered_at2 = (int) $user2->getPreference(User::PREF_TIMESTAMP_REGISTERED);
- $logged_in_at2 = (int) $user2->getPreference(User::PREF_TIMESTAMP_ACTIVE);
+ $registered_at1 = (int) $user1->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERED);
+ $logged_in_at1 = (int) $user1->getPreference(UserInterface::PREF_TIMESTAMP_ACTIVE);
+ $registered_at2 = (int) $user2->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERED);
+ $logged_in_at2 = (int) $user2->getPreference(UserInterface::PREF_TIMESTAMP_ACTIVE);
return max($registered_at1, $logged_in_at1) <=> max($registered_at2, $logged_in_at2);
};
@@ -178,8 +178,8 @@ class UserService
public function filterInactive(int $timestamp): Closure
{
return static function (UserInterface $user) use ($timestamp): bool {
- $registered_at = (int) $user->getPreference(User::PREF_TIMESTAMP_REGISTERED);
- $logged_in_at = (int) $user->getPreference(User::PREF_TIMESTAMP_ACTIVE);
+ $registered_at = (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERED);
+ $logged_in_at = (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_ACTIVE);
return max($registered_at, $logged_in_at) < $timestamp;
};
@@ -208,7 +208,7 @@ class UserService
{
return DB::table('user')
->join('user_setting', 'user_setting.user_id', '=', 'user.user_id')
- ->where('user_setting.setting_name', '=', User::PREF_IS_ADMINISTRATOR)
+ ->where('user_setting.setting_name', '=', UserInterface::PREF_IS_ADMINISTRATOR)
->where('user_setting.setting_value', '=', '1')
->where('user.user_id', '>', 0)
->orderBy('real_name')
@@ -226,8 +226,8 @@ class UserService
{
return DB::table('user')
->join('user_gedcom_setting', 'user_gedcom_setting.user_id', '=', 'user.user_id')
- ->where('user_gedcom_setting.setting_name', '=', User::PREF_TREE_ROLE)
- ->where('user_gedcom_setting.setting_value', '=', User::ROLE_MANAGER)
+ ->where('user_gedcom_setting.setting_name', '=', UserInterface::PREF_TREE_ROLE)
+ ->where('user_gedcom_setting.setting_value', '=', UserInterface::ROLE_MANAGER)
->where('user.user_id', '>', 0)
->groupBy(['user.user_id'])
->orderBy('real_name')
@@ -245,8 +245,8 @@ class UserService
{
return DB::table('user')
->join('user_gedcom_setting', 'user_gedcom_setting.user_id', '=', 'user.user_id')
- ->where('user_gedcom_setting.setting_name', '=', User::PREF_TREE_ROLE)
- ->where('user_gedcom_setting.setting_value', '=', User::ROLE_MODERATOR)
+ ->where('user_gedcom_setting.setting_name', '=', UserInterface::PREF_TREE_ROLE)
+ ->where('user_gedcom_setting.setting_value', '=', UserInterface::ROLE_MODERATOR)
->where('user.user_id', '>', 0)
->groupBy(['user.user_id'])
->orderBy('real_name')
@@ -266,7 +266,7 @@ class UserService
->leftJoin('user_setting', static function (JoinClause $join): void {
$join
->on('user_setting.user_id', '=', 'user.user_id')
- ->where('user_setting.setting_name', '=', User::PREF_IS_ACCOUNT_APPROVED);
+ ->where('user_setting.setting_name', '=', UserInterface::PREF_IS_ACCOUNT_APPROVED);
})
->where(static function (Builder $query): void {
$query
@@ -291,7 +291,7 @@ class UserService
->leftJoin('user_setting', static function (JoinClause $join): void {
$join
->on('user_setting.user_id', '=', 'user.user_id')
- ->where('user_setting.setting_name', '=', User::PREF_IS_EMAIL_VERIFIED);
+ ->where('user_setting.setting_name', '=', UserInterface::PREF_IS_EMAIL_VERIFIED);
})
->where(static function (Builder $query): void {
$query
@@ -398,7 +398,7 @@ class UserService
$user = $request->getAttribute('user');
- if ($contact_user->getPreference(User::PREF_CONTACT_METHOD) === 'mailto') {
+ if ($contact_user->getPreference(UserInterface::PREF_CONTACT_METHOD) === 'mailto') {
$url = 'mailto:' . $contact_user->email();
} elseif ($user instanceof User) {
// Logged-in users send direct messages
diff --git a/app/Statistics/Repository/LatestUserRepository.php b/app/Statistics/Repository/LatestUserRepository.php
index 603449dc89..6e155bc0ed 100644
--- a/app/Statistics/Repository/LatestUserRepository.php
+++ b/app/Statistics/Repository/LatestUserRepository.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -25,7 +25,6 @@ use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Statistics\Repository\Interfaces\LatestUserRepositoryInterface;
-use Fisharebest\Webtrees\User;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Query\Builder;
use Illuminate\Database\Query\JoinClause;
@@ -78,7 +77,7 @@ class LatestUserRepository implements LatestUserRepositoryInterface
->leftJoin('user_setting as us', static function (JoinClause $join): void {
$join->on(static function (Builder $query): void {
$query->whereColumn('u.user_id', '=', 'us.user_id')
- ->where('us.setting_name', '=', User::PREF_TIMESTAMP_REGISTERED);
+ ->where('us.setting_name', '=', UserInterface::PREF_TIMESTAMP_REGISTERED);
});
})
->orderByDesc('us.setting_value')
@@ -114,7 +113,7 @@ class LatestUserRepository implements LatestUserRepositoryInterface
{
$format = $format ?? I18N::dateFormat();
$user = $this->latestUserQuery();
- $timestamp = (int) $user->getPreference(User::PREF_TIMESTAMP_REGISTERED);
+ $timestamp = (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERED);
return Carbon::createFromTimestamp($timestamp)->format(strtr($format, ['%' => '']));
}
@@ -129,7 +128,7 @@ class LatestUserRepository implements LatestUserRepositoryInterface
$format = $format ?? str_replace('%', '', I18N::timeFormat());
$user = $this->latestUserQuery();
- return date($format, (int) $user->getPreference(User::PREF_TIMESTAMP_REGISTERED));
+ return date($format, (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERED));
}
/**
diff --git a/app/Statistics/Repository/UserRepository.php b/app/Statistics/Repository/UserRepository.php
index 7cbac68efd..77bd44ab51 100644
--- a/app/Statistics/Repository/UserRepository.php
+++ b/app/Statistics/Repository/UserRepository.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -28,7 +28,6 @@ use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\Statistics\Repository\Interfaces\UserRepositoryInterface;
use Fisharebest\Webtrees\Tree;
-use Fisharebest\Webtrees\User;
use function count;
@@ -72,7 +71,7 @@ class UserRepository implements UserRepositoryInterface
$logged_in = [];
foreach ($this->user_service->allLoggedIn() as $user) {
- if (Auth::isAdmin() || $user->getPreference(User::PREF_IS_VISIBLE_ONLINE) === '1') {
+ if (Auth::isAdmin() || $user->getPreference(UserInterface::PREF_IS_VISIBLE_ONLINE) === '1') {
$logged_in[] = $user;
} else {
$anonymous++;
@@ -111,7 +110,7 @@ class UserRepository implements UserRepositoryInterface
$content .= '<li>';
}
- $individual = Registry::individualFactory()->make($this->tree->getUserPreference($user, User::PREF_TREE_ACCOUNT_XREF), $this->tree);
+ $individual = Registry::individualFactory()->make($this->tree->getUserPreference($user, UserInterface::PREF_TREE_ACCOUNT_XREF), $this->tree);
if ($individual instanceof Individual && $individual->canShow()) {
$content .= '<a href="' . e($individual->url()) . '">' . e($user->realName()) . '</a>';
@@ -121,7 +120,7 @@ class UserRepository implements UserRepositoryInterface
$content .= ' - ' . e($user->userName());
- if ($user->getPreference(User::PREF_CONTACT_METHOD) !== 'none' && Auth::id() !== $user->id()) {
+ if ($user->getPreference(UserInterface::PREF_CONTACT_METHOD) !== 'none' && Auth::id() !== $user->id()) {
$content .= '<a href="' . e(route(MessagePage::class, ['to' => $user->userName(), 'tree' => $this->tree->name()])) . '" class="btn btn-link" title="' . I18N::translate('Send a message') . '">' . view('icons/email') . '</a>';
}
@@ -163,7 +162,7 @@ class UserRepository implements UserRepositoryInterface
*/
private function isUserVisible(UserInterface $user): bool
{
- return Auth::isAdmin() || $user->getPreference(User::PREF_IS_VISIBLE_ONLINE) === '1';
+ return Auth::isAdmin() || $user->getPreference(UserInterface::PREF_IS_VISIBLE_ONLINE) === '1';
}
/**
diff --git a/app/Tree.php b/app/Tree.php
index 2048b1c3f3..428ebbf605 100644
--- a/app/Tree.php
+++ b/app/Tree.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -468,7 +468,7 @@ class Tree
]);
// Accept this pending change
- if (Auth::user()->getPreference(User::PREF_AUTO_ACCEPT_EDITS)) {
+ if (Auth::user()->getPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS) === '1') {
$record = Registry::gedcomRecordFactory()->new($xref, $gedcom, null, $this);
app(PendingChangesService::class)->acceptRecord($record);
@@ -522,7 +522,7 @@ class Tree
]);
// Accept this pending change
- if (Auth::user()->getPreference(User::PREF_AUTO_ACCEPT_EDITS) === '1') {
+ if (Auth::user()->getPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS) === '1') {
$record = Registry::familyFactory()->new($xref, $gedcom, null, $this);
app(PendingChangesService::class)->acceptRecord($record);
@@ -565,7 +565,7 @@ class Tree
]);
// Accept this pending change
- if (Auth::user()->getPreference(User::PREF_AUTO_ACCEPT_EDITS) === '1') {
+ if (Auth::user()->getPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS) === '1') {
$record = Registry::individualFactory()->new($xref, $gedcom, null, $this);
app(PendingChangesService::class)->acceptRecord($record);
@@ -608,7 +608,7 @@ class Tree
]);
// Accept this pending change
- if (Auth::user()->getPreference(User::PREF_AUTO_ACCEPT_EDITS) === '1') {
+ if (Auth::user()->getPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS) === '1') {
$record = Registry::mediaFactory()->new($xref, $gedcom, null, $this);
app(PendingChangesService::class)->acceptRecord($record);
@@ -643,12 +643,12 @@ class Tree
}
}
- if ($individual === null && $this->getUserPreference($user, User::PREF_TREE_DEFAULT_XREF) !== '') {
- $individual = Registry::individualFactory()->make($this->getUserPreference($user, User::PREF_TREE_DEFAULT_XREF), $this);
+ if ($individual === null && $this->getUserPreference($user, UserInterface::PREF_TREE_DEFAULT_XREF) !== '') {
+ $individual = Registry::individualFactory()->make($this->getUserPreference($user, UserInterface::PREF_TREE_DEFAULT_XREF), $this);
}
- if ($individual === null && $this->getUserPreference($user, User::PREF_TREE_ACCOUNT_XREF) !== '') {
- $individual = Registry::individualFactory()->make($this->getUserPreference($user, User::PREF_TREE_ACCOUNT_XREF), $this);
+ if ($individual === null && $this->getUserPreference($user, UserInterface::PREF_TREE_ACCOUNT_XREF) !== '') {
+ $individual = Registry::individualFactory()->make($this->getUserPreference($user, UserInterface::PREF_TREE_ACCOUNT_XREF), $this);
}
if ($individual === null && $this->getPreference('PEDIGREE_ROOT_ID') !== '') {
diff --git a/app/User.php b/app/User.php
index a5479c6515..933e3abdc6 100644
--- a/app/User.php
+++ b/app/User.php
@@ -30,34 +30,6 @@ use stdClass;
*/
class User implements UserInterface
{
- // For historic reasons, user preferences have inconsistent and confusing names.
- public const PREF_AUTO_ACCEPT_EDITS = 'auto_accept';
- public const PREF_CONTACT_METHOD = 'contactmethod';
- public const PREF_IS_ACCOUNT_APPROVED = 'verified_by_admin';
- public const PREF_IS_ADMINISTRATOR = 'canadmin';
- public const PREF_IS_EMAIL_VERIFIED = 'verified';
- public const PREF_IS_VISIBLE_ONLINE = 'visibleonline';
- public const PREF_LANGUAGE = 'language';
- public const PREF_NEW_ACCOUNT_COMMENT = 'comment';
- public const PREF_TIMESTAMP_REGISTERED = 'reg_timestamp';
- public const PREF_TIMESTAMP_ACTIVE = 'sessiontime';
- public const PREF_TIME_ZONE = 'TIMEZONE';
- public const PREF_THEME = 'theme';
- public const PREF_VERIFICATION_TOKEN = 'reg_hashcode';
-
- // For historic reasons, user-tree preferences have inconsistent and confusing names.
- public const PREF_TREE_ACCOUNT_XREF = 'gedcomid';
- public const PREF_TREE_DEFAULT_XREF = 'rootid';
- public const PREF_TREE_PATH_LENGTH = 'RELATIONSHIP_PATH_LENGTH';
- public const PREF_TREE_ROLE = 'canedit';
-
- // For historic reasons, roles have inconsistent and confusing names.
- public const ROLE_VISITOR = 'none';
- public const ROLE_MEMBER = 'access';
- public const ROLE_EDITOR = 'edit';
- public const ROLE_MODERATOR = 'accept';
- public const ROLE_MANAGER = 'admin';
-
/** @var int The primary key of this user. */
private $user_id;
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index 8291bd8305..8f9f4bccdd 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -375,11 +375,6 @@ parameters:
path: app/Http/Controllers/Admin/LocationController.php
-
- message: "#^Method Fisharebest\\\\Webtrees\\\\Http\\\\Controllers\\\\Admin\\\\UsersController\\:\\:themeOptions\\(\\) should return Illuminate\\\\Support\\\\Collection&iterable\\<string\\> but returns Illuminate\\\\Support\\\\Collection&iterable\\<Fisharebest\\\\Webtrees\\\\Module\\\\ModuleInterface\\>\\.$#"
- count: 1
- path: app/Http/Controllers/Admin/UsersController.php
-
- -
message: "#^Parameter \\#1 \\$path of method Psr\\\\Http\\\\Message\\\\UriInterface\\:\\:withPath\\(\\) expects string, string\\|false given\\.$#"
count: 1
path: app/Http/Middleware/BaseUrl.php
diff --git a/resources/views/admin/users-cleanup.phtml b/resources/views/admin/users-cleanup.phtml
index 8d3fe5b4c1..c248741920 100644
--- a/resources/views/admin/users-cleanup.phtml
+++ b/resources/views/admin/users-cleanup.phtml
@@ -1,6 +1,7 @@
<?php
use Fisharebest\Webtrees\Carbon;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
use Fisharebest\Webtrees\Http\RequestHandlers\UsersCleanupAction;
use Fisharebest\Webtrees\I18N;
@@ -30,7 +31,7 @@ use Fisharebest\Webtrees\User;
</td>
<td>
<?= I18N::translate('User’s account has been inactive too long: ') ?>
- <?= view('components/datetime', ['timestamp' => Carbon::createFromTimestamp(max((int) $user->getPreference(User::PREF_TIMESTAMP_REGISTERED), (int) $user->getPreference(User::PREF_TIMESTAMP_ACTIVE)))]) ?>
+ <?= view('components/datetime', ['timestamp' => Carbon::createFromTimestamp(max((int) $user->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERED), (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_ACTIVE)))]) ?>
</td>
</tr>
<?php endforeach ?>
@@ -49,7 +50,7 @@ use Fisharebest\Webtrees\User;
</td>
<td>
<?= I18N::translate('User didn’t verify within 7 days.') ?>
- <?php if ($user->getPreference(User::PREF_IS_ACCOUNT_APPROVED) !== '1') : ?>
+ <?php if ($user->getPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED) !== '1') : ?>
<?= I18N::translate('User not verified by administrator.') ?>
<?php endif ?>
</td>
diff --git a/resources/views/admin/users-edit.phtml b/resources/views/admin/users-edit.phtml
index 16171ac793..02b81a3a82 100644
--- a/resources/views/admin/users-edit.phtml
+++ b/resources/views/admin/users-edit.phtml
@@ -1,6 +1,7 @@
<?php
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
use Fisharebest\Webtrees\I18N;
@@ -78,11 +79,11 @@ use Fisharebest\Webtrees\View;
<div class="col-sm-9">
<div class="form-check">
<label>
- <input type="checkbox" name="verified" value="1" <?= $user->getPreference(User::PREF_IS_EMAIL_VERIFIED) === '1' ? 'checked' : '' ?>>
+ <input type="checkbox" name="verified" value="1" <?= $user->getPreference(UserInterface::PREF_IS_EMAIL_VERIFIED) === '1' ? 'checked' : '' ?>>
<?= I18N::translate('Email verified') ?>
</label>
<label>
- <input type="checkbox" name="approved" value="1" <?= $user->getPreference(User::PREF_IS_ACCOUNT_APPROVED) === '1' ? 'checked' : '' ?>>
+ <input type="checkbox" name="approved" value="1" <?= $user->getPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED) === '1' ? 'checked' : '' ?>>
<?= I18N::translate('Approved by administrator') ?>
</label>
<p class="small text-muted">
@@ -107,7 +108,7 @@ use Fisharebest\Webtrees\View;
<?= /* I18N: A configuration setting */ I18N::translate('Language') ?>
</label>
<div class="col-sm-9">
- <?= view('components/select', ['name' => 'language', 'selected' => $user->getPreference(User::PREF_LANGUAGE, $default_language), 'options' => $languages]) ?>
+ <?= view('components/select', ['name' => 'language', 'selected' => $user->getPreference(UserInterface::PREF_LANGUAGE, $default_language), 'options' => $languages]) ?>
</div>
</div>
@@ -117,7 +118,7 @@ use Fisharebest\Webtrees\View;
<?= /* I18N: A configuration setting */ I18N::translate('Time zone') ?>
</label>
<div class="col-sm-9">
- <?= view('components/select', ['name' => 'timezone', 'selected' => $user->getPreference(User::PREF_TIME_ZONE, 'UTC'), 'options' => array_combine(DateTimeZone::listIdentifiers(), DateTimeZone::listIdentifiers())]) ?>
+ <?= view('components/select', ['name' => 'timezone', 'selected' => $user->getPreference(UserInterface::PREF_TIME_ZONE, 'UTC'), 'options' => array_combine(DateTimeZone::listIdentifiers(), DateTimeZone::listIdentifiers())]) ?>
<p class="small text-muted">
<?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
</p>
@@ -132,7 +133,7 @@ use Fisharebest\Webtrees\View;
<div class="col-sm-9">
<div class="form-check">
<label>
- <input type="checkbox" name="auto_accept" value="1" <?= $user->getPreference(User::PREF_AUTO_ACCEPT_EDITS) === '1' ? 'checked' : '' ?>>
+ <input type="checkbox" name="auto_accept" value="1" <?= $user->getPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS) === '1' ? 'checked' : '' ?>>
<?= I18N::translate('Automatically accept changes made by this user') ?>
</label>
<p class="small text-muted">
@@ -150,7 +151,7 @@ use Fisharebest\Webtrees\View;
<div class="col-sm-9">
<div class="form-check">
<label>
- <input type="checkbox" id="visible-online" name="visible-online" value="1" <?= $user->getPreference(User::PREF_IS_VISIBLE_ONLINE) === '1' ? 'checked' : '' ?>>
+ <input type="checkbox" id="visible-online" name="visible-online" value="1" <?= $user->getPreference(UserInterface::PREF_IS_VISIBLE_ONLINE) === '1' ? 'checked' : '' ?>>
<?= /* I18N: A configuration setting */ I18N::translate('Visible to other users when online') ?>
</label>
<p class="small text-muted">
@@ -166,7 +167,7 @@ use Fisharebest\Webtrees\View;
<?= /* I18N: A configuration setting */ I18N::translate('Preferred contact method') ?>
</label>
<div class="col-sm-9">
- <?= view('components/select', ['id' => 'contact-method', 'name' => 'contact-method', 'selected' => $user->getPreference(User::PREF_CONTACT_METHOD), 'options' => $contact_methods]) ?>
+ <?= view('components/select', ['id' => 'contact-method', 'name' => 'contact-method', 'selected' => $user->getPreference(UserInterface::PREF_CONTACT_METHOD), 'options' => $contact_methods]) ?>
<p class="small text-muted">
<?= /* I18N: Help text for the “Preferred contact method” configuration setting */
I18N::translate('Site members can send each other messages. You can choose to how these messages are sent to you, or choose not receive them at all.') ?>
@@ -180,7 +181,7 @@ use Fisharebest\Webtrees\View;
<?= I18N::translate('Theme') ?>
</label>
<div class="col-sm-9">
- <?= view('components/select', ['name' => 'theme', 'selected' => $user->getPreference(User::PREF_THEME), 'options' => $theme_options]) ?>
+ <?= view('components/select', ['name' => 'theme', 'selected' => $user->getPreference(UserInterface::PREF_THEME), 'options' => $theme_options]) ?>
</div>
</div>
@@ -190,7 +191,7 @@ use Fisharebest\Webtrees\View;
<?= I18N::translate('Administrator comments on user') ?>
</label>
<div class="col-sm-9">
- <textarea class="form-control" id="comment" name="comment" rows="4" dir="auto" maxlength="255"><?= e($user->getPreference(User::PREF_NEW_ACCOUNT_COMMENT)) ?></textarea>
+ <textarea class="form-control" id="comment" name="comment" rows="4" dir="auto" maxlength="255"><?= e($user->getPreference(UserInterface::PREF_NEW_ACCOUNT_COMMENT)) ?></textarea>
</div>
</div>
@@ -201,7 +202,7 @@ use Fisharebest\Webtrees\View;
<div class="col-sm-9">
<div class="form-check">
<label>
- <input type="checkbox" id="admin" name="canadmin" value="1" <?= $user->getPreference(User::PREF_IS_ADMINISTRATOR) === '1' ? 'checked' : '' ?> <?= $user->id() === Auth::id() ? 'disabled' : '' ?>>
+ <input type="checkbox" id="admin" name="canadmin" value="1" <?= $user->getPreference(UserInterface::PREF_IS_ADMINISTRATOR) === '1' ? 'checked' : '' ?> <?= $user->id() === Auth::id() ? 'disabled' : '' ?>>
<?= I18N::translate('Administrator') ?>
</label>
</div>
@@ -300,7 +301,7 @@ use Fisharebest\Webtrees\View;
<select class="form-control" name="canedit<?= $tree->id() ?>">
<?php foreach ($roles as $role => $description) : ?>
<option value="<?= $role ?>"
- <?= $role === $tree->getUserPreference($user, User::PREF_TREE_ROLE) ? 'selected' : '' ?>>
+ <?= $role === $tree->getUserPreference($user, UserInterface::PREF_TREE_ROLE) ? 'selected' : '' ?>>
<?= $description ?>
</option>
<?php endforeach ?>
@@ -312,7 +313,7 @@ use Fisharebest\Webtrees\View;
<td>
<select class="form-control" name="RELATIONSHIP_PATH_LENGTH<?= $tree->id() ?>" id="RELATIONSHIP_PATH_LENGTH<?= $tree->id() ?>" class="relpath">
<?php for ($n = 0; $n <= 10; ++$n) : ?>
- <option value="<?= $n ?>" <?= $tree->getUserPreference($user, User::PREF_TREE_PATH_LENGTH) == $n ? 'selected' : '' ?>>
+ <option value="<?= $n ?>" <?= $tree->getUserPreference($user, UserInterface::PREF_TREE_PATH_LENGTH) == $n ? 'selected' : '' ?>>
<?= $n ?: I18N::translate('No') ?>
</option>
<?php endfor ?>
diff --git a/resources/views/edit-account-page.phtml b/resources/views/edit-account-page.phtml
index 1a9c91d2bd..a66c140b2e 100644
--- a/resources/views/edit-account-page.phtml
+++ b/resources/views/edit-account-page.phtml
@@ -1,5 +1,6 @@
<?php
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Http\RequestHandlers\AccountDelete;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Tree;
@@ -90,7 +91,7 @@ use Fisharebest\Webtrees\View;
<?= I18N::translate('Language') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= view('components/select', ['name' => 'language', 'selected' => $user->getPreference(User::PREF_LANGUAGE), 'options' => $languages]) ?>
+ <?= view('components/select', ['name' => 'language', 'selected' => $user->getPreference(UserInterface::PREF_LANGUAGE), 'options' => $languages]) ?>
</div>
</div>
@@ -99,7 +100,7 @@ use Fisharebest\Webtrees\View;
<?= I18N::translate('Time zone') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= view('components/select', ['name' => 'timezone', 'selected' => $user->getPreference(User::PREF_TIME_ZONE, 'UTC'), 'options' => $timezones]) ?>
+ <?= view('components/select', ['name' => 'timezone', 'selected' => $user->getPreference(UserInterface::PREF_TIME_ZONE, 'UTC'), 'options' => $timezones]) ?>
<p class="small text-muted" id="timezone-description">
<?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
</p>
@@ -123,7 +124,7 @@ use Fisharebest\Webtrees\View;
<?= I18N::translate('Contact method') ?>
</label>
<div class="col-sm-9 wt-page-options-value">
- <?= view('components/select', ['name' => 'contact-method', 'id' => 'contact-method', 'selected' => $user->getPreference(User::PREF_CONTACT_METHOD), 'options' => $contact_methods]) ?>
+ <?= view('components/select', ['name' => 'contact-method', 'id' => 'contact-method', 'selected' => $user->getPreference(UserInterface::PREF_CONTACT_METHOD), 'options' => $contact_methods]) ?>
<p class="small text-muted" id="contact-method-description">
<?= I18N::translate('Site members can send each other messages. You can choose to how these messages are sent to you, or choose not receive them at all.') ?>
</p>
@@ -136,7 +137,7 @@ use Fisharebest\Webtrees\View;
<?= I18N::translate('Visible online') ?>
</legend>
<div class="col-sm-9 wt-page-options-value">
- <?= view('components/checkbox', ['label' => I18N::translate('Visible to other users when online'), 'name' => 'visible-online', 'checked' => (bool) $user->getPreference(User::PREF_IS_VISIBLE_ONLINE)]) ?>
+ <?= view('components/checkbox', ['label' => I18N::translate('Visible to other users when online'), 'name' => 'visible-online', 'checked' => (bool) $user->getPreference(UserInterface::PREF_IS_VISIBLE_ONLINE)]) ?>
<p class="small text-muted" id="visible-online-description">
<?= I18N::translate('You can choose whether to appear in the list of users who are currently signed-in.') ?>
</p>
diff --git a/tests/app/Http/Middleware/AuthAdministratorTest.php b/tests/app/Http/Middleware/AuthAdministratorTest.php
index 24658c8db9..99520ab563 100644
--- a/tests/app/Http/Middleware/AuthAdministratorTest.php
+++ b/tests/app/Http/Middleware/AuthAdministratorTest.php
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\Middleware;
use Fig\Http\Message\StatusCodeInterface;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Exceptions\HttpAccessDeniedException;
use Fisharebest\Webtrees\GuestUser;
use Fisharebest\Webtrees\TestCase;
@@ -44,7 +45,7 @@ class AuthAdministratorTest extends TestCase
$handler->method('handle')->willReturn(response('lorem ipsum'));
$user = self::createMock(User::class);
- $user->method('getPreference')->with(User::PREF_IS_ADMINISTRATOR)->willReturn('1');
+ $user->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('1');
$request = self::createRequest()->withAttribute('user', $user);
$middleware = new AuthAdministrator();
@@ -66,7 +67,7 @@ class AuthAdministratorTest extends TestCase
$handler->method('handle')->willReturn(response('lorem ipsum'));
$user = self::createMock(User::class);
- $user->method('getPreference')->with(User::PREF_IS_ADMINISTRATOR)->willReturn('');
+ $user->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('');
$request = self::createRequest()->withAttribute('user', $user);
$middleware = new AuthAdministrator();
diff --git a/tests/app/Http/Middleware/AuthEditorTest.php b/tests/app/Http/Middleware/AuthEditorTest.php
index cad2a26cae..29eea421cf 100644
--- a/tests/app/Http/Middleware/AuthEditorTest.php
+++ b/tests/app/Http/Middleware/AuthEditorTest.php
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\Middleware;
use Fig\Http\Message\StatusCodeInterface;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Exceptions\HttpAccessDeniedException;
use Fisharebest\Webtrees\GuestUser;
use Fisharebest\Webtrees\TestCase;
@@ -45,10 +46,10 @@ class AuthEditorTest extends TestCase
$handler->method('handle')->willReturn(response('lorem ipsum'));
$user = self::createMock(User::class);
- $user->method('getPreference')->with(User::PREF_IS_ADMINISTRATOR)->willReturn('');
+ $user->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('');
$tree = self::createMock(Tree::class);
- $tree->method('getUserPreference')->with($user, User::PREF_TREE_ROLE)->willReturn('edit');
+ $tree->method('getUserPreference')->with($user, UserInterface::PREF_TREE_ROLE)->willReturn(UserInterface::ROLE_EDITOR);
$request = self::createRequest()->withAttribute('tree', $tree)->withAttribute('user', $user);
$middleware = new AuthEditor();
@@ -70,10 +71,10 @@ class AuthEditorTest extends TestCase
$handler->method('handle')->willReturn(response('lorem ipsum'));
$user = self::createMock(User::class);
- $user->method('getPreference')->with(User::PREF_IS_ADMINISTRATOR)->willReturn('');
+ $user->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('');
$tree = self::createMock(Tree::class);
- $tree->method('getUserPreference')->with($user, User::PREF_TREE_ROLE)->willReturn('access');
+ $tree->method('getUserPreference')->with($user, UserInterface::PREF_TREE_ROLE)->willReturn(UserInterface::ROLE_MEMBER);
$request = self::createRequest()->withAttribute('tree', $tree)->withAttribute('user', $user);
$middleware = new AuthEditor();
diff --git a/tests/app/Http/Middleware/AuthManagerTest.php b/tests/app/Http/Middleware/AuthManagerTest.php
index 1ec1f6069a..aa2c9fdc45 100644
--- a/tests/app/Http/Middleware/AuthManagerTest.php
+++ b/tests/app/Http/Middleware/AuthManagerTest.php
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\Middleware;
use Fig\Http\Message\StatusCodeInterface;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Exceptions\HttpAccessDeniedException;
use Fisharebest\Webtrees\GuestUser;
use Fisharebest\Webtrees\TestCase;
@@ -45,10 +46,10 @@ class AuthManagerTest extends TestCase
$handler->method('handle')->willReturn(response('lorem ipsum'));
$user = self::createMock(User::class);
- $user->method('getPreference')->with(User::PREF_IS_ADMINISTRATOR)->willReturn('');
+ $user->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('');
$tree = self::createMock(Tree::class);
- $tree->method('getUserPreference')->with($user, User::PREF_TREE_ROLE)->willReturn(User::ROLE_MANAGER);
+ $tree->method('getUserPreference')->with($user, UserInterface::PREF_TREE_ROLE)->willReturn(UserInterface::ROLE_MANAGER);
$request = self::createRequest()->withAttribute('tree', $tree)->withAttribute('user', $user);
$middleware = new AuthManager();
@@ -70,10 +71,10 @@ class AuthManagerTest extends TestCase
$handler->method('handle')->willReturn(response('lorem ipsum'));
$user = self::createMock(User::class);
- $user->method('getPreference')->with(User::PREF_IS_ADMINISTRATOR)->willReturn('');
+ $user->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('');
$tree = self::createMock(Tree::class);
- $tree->method('getUserPreference')->with($user, User::PREF_TREE_ROLE)->willReturn(User::ROLE_MODERATOR);
+ $tree->method('getUserPreference')->with($user, UserInterface::PREF_TREE_ROLE)->willReturn(UserInterface::ROLE_MODERATOR);
$request = self::createRequest()->withAttribute('tree', $tree)->withAttribute('user', $user);
$middleware = new AuthManager();
diff --git a/tests/app/Http/Middleware/AuthMemberTest.php b/tests/app/Http/Middleware/AuthMemberTest.php
index e143464565..0af99c9140 100644
--- a/tests/app/Http/Middleware/AuthMemberTest.php
+++ b/tests/app/Http/Middleware/AuthMemberTest.php
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\Middleware;
use Fig\Http\Message\StatusCodeInterface;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Exceptions\HttpAccessDeniedException;
use Fisharebest\Webtrees\GuestUser;
use Fisharebest\Webtrees\TestCase;
@@ -45,10 +46,10 @@ class AuthMemberTest extends TestCase
$handler->method('handle')->willReturn(response('lorem ipsum'));
$user = self::createMock(User::class);
- $user->method('getPreference')->with(User::PREF_IS_ADMINISTRATOR)->willReturn('');
+ $user->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('');
$tree = self::createMock(Tree::class);
- $tree->method('getUserPreference')->with($user, User::PREF_TREE_ROLE)->willReturn('access');
+ $tree->method('getUserPreference')->with($user, UserInterface::PREF_TREE_ROLE)->willReturn(UserInterface::ROLE_MEMBER);
$request = self::createRequest()->withAttribute('tree', $tree)->withAttribute('user', $user);
$middleware = new AuthMember();
@@ -70,10 +71,10 @@ class AuthMemberTest extends TestCase
$handler->method('handle')->willReturn(response('lorem ipsum'));
$user = self::createMock(User::class);
- $user->method('getPreference')->with(User::PREF_IS_ADMINISTRATOR)->willReturn('');
+ $user->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('');
$tree = self::createMock(Tree::class);
- $tree->method('getUserPreference')->with($user, User::PREF_TREE_ROLE)->willReturn('');
+ $tree->method('getUserPreference')->with($user, UserInterface::PREF_TREE_ROLE)->willReturn('');
$request = self::createRequest()->withAttribute('tree', $tree)->withAttribute('user', $user);
$middleware = new AuthMember();
diff --git a/tests/app/Http/Middleware/AuthModeratorTest.php b/tests/app/Http/Middleware/AuthModeratorTest.php
index 81c89fa2a4..aa0702b434 100644
--- a/tests/app/Http/Middleware/AuthModeratorTest.php
+++ b/tests/app/Http/Middleware/AuthModeratorTest.php
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\Middleware;
use Fig\Http\Message\StatusCodeInterface;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Exceptions\HttpAccessDeniedException;
use Fisharebest\Webtrees\GuestUser;
use Fisharebest\Webtrees\TestCase;
@@ -45,10 +46,10 @@ class AuthModeratorTest extends TestCase
$handler->method('handle')->willReturn(response('lorem ipsum'));
$user = self::createMock(User::class);
- $user->method('getPreference')->with(User::PREF_IS_ADMINISTRATOR)->willReturn('');
+ $user->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('');
$tree = self::createMock(Tree::class);
- $tree->method('getUserPreference')->with($user, User::PREF_TREE_ROLE)->willReturn(User::ROLE_MODERATOR);
+ $tree->method('getUserPreference')->with($user, UserInterface::PREF_TREE_ROLE)->willReturn(UserInterface::ROLE_MODERATOR);
$request = self::createRequest()->withAttribute('tree', $tree)->withAttribute('user', $user);
$middleware = new AuthModerator();
@@ -70,10 +71,10 @@ class AuthModeratorTest extends TestCase
$handler->method('handle')->willReturn(response('lorem ipsum'));
$user = self::createMock(User::class);
- $user->method('getPreference')->with(User::PREF_IS_ADMINISTRATOR)->willReturn('');
+ $user->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('');
$tree = self::createMock(Tree::class);
- $tree->method('getUserPreference')->with($user, User::PREF_TREE_ROLE)->willReturn('edit');
+ $tree->method('getUserPreference')->with($user, UserInterface::PREF_TREE_ROLE)->willReturn(UserInterface::ROLE_EDITOR);
$request = self::createRequest()->withAttribute('tree', $tree)->withAttribute('user', $user);
$middleware = new AuthModerator();
diff --git a/tests/app/Http/Middleware/CheckForMaintenanceModeTest.php b/tests/app/Http/Middleware/CheckForMaintenanceModeTest.php
index 5e2270b380..bfcba82f8b 100644
--- a/tests/app/Http/Middleware/CheckForMaintenanceModeTest.php
+++ b/tests/app/Http/Middleware/CheckForMaintenanceModeTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,7 +20,6 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\Middleware;
use Fig\Http\Message\StatusCodeInterface;
-use Fisharebest\Webtrees\Http\Middleware\CheckForMaintenanceMode;
use Fisharebest\Webtrees\TestCase;
use Psr\Http\Server\RequestHandlerInterface;
diff --git a/tests/app/Http/RequestHandlers/AccountUpdateTest.php b/tests/app/Http/RequestHandlers/AccountUpdateTest.php
index dc74bccd6f..03823b8ba0 100644
--- a/tests/app/Http/RequestHandlers/AccountUpdateTest.php
+++ b/tests/app/Http/RequestHandlers/AccountUpdateTest.php
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\Controllers\Admin;
use Fig\Http\Message\StatusCodeInterface;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Http\RequestHandlers\AccountUpdate;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
@@ -48,14 +49,14 @@ class AccountUpdateTest extends TestCase
$user->expects(self::exactly(4))
->method('setPreference')
->withConsecutive(
- [User::PREF_CONTACT_METHOD, 'a'],
- [User::PREF_LANGUAGE, 'c'],
- [User::PREF_TIME_ZONE, 'g'],
- [User::PREF_IS_VISIBLE_ONLINE, 'i']
+ [UserInterface::PREF_CONTACT_METHOD, 'a'],
+ [UserInterface::PREF_LANGUAGE, 'c'],
+ [UserInterface::PREF_TIME_ZONE, 'g'],
+ [UserInterface::PREF_IS_VISIBLE_ONLINE, 'i']
);
$tree = self::createMock(Tree::class);
- $tree->expects(self::once())->method('setUserPreference')->with($user, User::PREF_TREE_DEFAULT_XREF, 'f');
+ $tree->expects(self::once())->method('setUserPreference')->with($user, UserInterface::PREF_TREE_DEFAULT_XREF, 'f');
$handler = new AccountUpdate($user_service);
$request = self::createRequest()
diff --git a/tests/app/Http/RequestHandlers/DeleteUserTest.php b/tests/app/Http/RequestHandlers/DeleteUserTest.php
index efaeb420d0..1072a2e7cc 100644
--- a/tests/app/Http/RequestHandlers/DeleteUserTest.php
+++ b/tests/app/Http/RequestHandlers/DeleteUserTest.php
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Http\RequestHandlers;
use Fig\Http\Message\StatusCodeInterface;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Exceptions\HttpAccessDeniedException;
use Fisharebest\Webtrees\Exceptions\HttpNotFoundException;
use Fisharebest\Webtrees\Services\UserService;
@@ -79,7 +80,7 @@ class DeleteUserTest extends TestCase
$user = self::createMock(User::class);
$user->method('id')->willReturn(1);
- $user->expects(self::once())->method('getPreference')->with(User::PREF_IS_ADMINISTRATOR)->willReturn('1');
+ $user->expects(self::once())->method('getPreference')->with(UserInterface::PREF_IS_ADMINISTRATOR)->willReturn('1');
$user_service = self::createMock(UserService::class);
$user_service->expects(self::once())->method('find')->willReturn($user);
diff --git a/tests/app/Module/AhnentafelReportModuleTest.php b/tests/app/Module/AhnentafelReportModuleTest.php
index 9c116aef0b..610f72959e 100644
--- a/tests/app/Module/AhnentafelReportModuleTest.php
+++ b/tests/app/Module/AhnentafelReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -80,7 +80,7 @@ class AhnentafelReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/BirthReportModuleTest.php b/tests/app/Module/BirthReportModuleTest.php
index b9d6fda9a4..e7410bec6d 100644
--- a/tests/app/Module/BirthReportModuleTest.php
+++ b/tests/app/Module/BirthReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -77,7 +77,7 @@ class BirthReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/CemeteryReportModuleTest.php b/tests/app/Module/CemeteryReportModuleTest.php
index 4fd5bc8911..910be82b48 100644
--- a/tests/app/Module/CemeteryReportModuleTest.php
+++ b/tests/app/Module/CemeteryReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -77,7 +77,7 @@ class CemeteryReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/ChangeReportModuleTest.php b/tests/app/Module/ChangeReportModuleTest.php
index 247c023c5b..55fed74b3c 100644
--- a/tests/app/Module/ChangeReportModuleTest.php
+++ b/tests/app/Module/ChangeReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -21,6 +21,7 @@ namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Carbon;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -28,7 +29,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -78,7 +78,7 @@ class ChangeReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/DeathReportModuleTest.php b/tests/app/Module/DeathReportModuleTest.php
index d825c2e6a3..c9c7e29d60 100644
--- a/tests/app/Module/DeathReportModuleTest.php
+++ b/tests/app/Module/DeathReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -77,7 +77,7 @@ class DeathReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/DescendancyReportModuleTest.php b/tests/app/Module/DescendancyReportModuleTest.php
index e3603c0816..8e61ccbecc 100644
--- a/tests/app/Module/DescendancyReportModuleTest.php
+++ b/tests/app/Module/DescendancyReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -80,7 +80,7 @@ class DescendancyReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/FactSourcesReportModuleTest.php b/tests/app/Module/FactSourcesReportModuleTest.php
index 80b403eb90..5a70758d71 100644
--- a/tests/app/Module/FactSourcesReportModuleTest.php
+++ b/tests/app/Module/FactSourcesReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -77,7 +77,7 @@ class FactSourcesReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/FamilyGroupReportModuleTest.php b/tests/app/Module/FamilyGroupReportModuleTest.php
index 645336d534..9bdad4a0c2 100644
--- a/tests/app/Module/FamilyGroupReportModuleTest.php
+++ b/tests/app/Module/FamilyGroupReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -77,7 +77,7 @@ class FamilyGroupReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/IndividualFamiliesReportModuleTest.php b/tests/app/Module/IndividualFamiliesReportModuleTest.php
index 9e0ea8470a..59514e9678 100644
--- a/tests/app/Module/IndividualFamiliesReportModuleTest.php
+++ b/tests/app/Module/IndividualFamiliesReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -80,7 +80,7 @@ class IndividualFamiliesReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/IndividualReportModuleTest.php b/tests/app/Module/IndividualReportModuleTest.php
index cf815f919b..4ce96b2418 100644
--- a/tests/app/Module/IndividualReportModuleTest.php
+++ b/tests/app/Module/IndividualReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -77,7 +77,7 @@ class IndividualReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/MarriageReportModuleTest.php b/tests/app/Module/MarriageReportModuleTest.php
index 87159dd831..f4e29ea3d8 100644
--- a/tests/app/Module/MarriageReportModuleTest.php
+++ b/tests/app/Module/MarriageReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -77,7 +77,7 @@ class MarriageReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/MissingFactsReportModuleTest.php b/tests/app/Module/MissingFactsReportModuleTest.php
index 7d9547b187..bfabf3420c 100644
--- a/tests/app/Module/MissingFactsReportModuleTest.php
+++ b/tests/app/Module/MissingFactsReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -77,7 +77,7 @@ class MissingFactsReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/OccupationReportModuleTest.php b/tests/app/Module/OccupationReportModuleTest.php
index 5af3717062..502a14b0e1 100644
--- a/tests/app/Module/OccupationReportModuleTest.php
+++ b/tests/app/Module/OccupationReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -77,7 +77,7 @@ class OccupationReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/PedigreeReportModuleTest.php b/tests/app/Module/PedigreeReportModuleTest.php
index 8b1425fb83..268c1bb93b 100644
--- a/tests/app/Module/PedigreeReportModuleTest.php
+++ b/tests/app/Module/PedigreeReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -79,7 +79,7 @@ class PedigreeReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Module/RelatedIndividualsReportModuleTest.php b/tests/app/Module/RelatedIndividualsReportModuleTest.php
index f23cc55f46..51a3200cb0 100644
--- a/tests/app/Module/RelatedIndividualsReportModuleTest.php
+++ b/tests/app/Module/RelatedIndividualsReportModuleTest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2020 webtrees development team
+ * Copyright (C) 2021 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Module;
use Fisharebest\Webtrees\Auth;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Report\HtmlRenderer;
use Fisharebest\Webtrees\Report\ReportParserGenerate;
use Fisharebest\Webtrees\Report\ReportParserSetup;
@@ -27,7 +28,6 @@ use Fisharebest\Webtrees\Report\PdfRenderer;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\UserService;
use Fisharebest\Webtrees\TestCase;
-use Fisharebest\Webtrees\User;
use League\Flysystem\Adapter\NullAdapter;
use League\Flysystem\Filesystem;
@@ -77,7 +77,7 @@ class RelatedIndividualsReportModuleTest extends TestCase
$module_service = new ModuleService();
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree = $this->importTree('demo.ged');
diff --git a/tests/app/Services/UserServiceTest.php b/tests/app/Services/UserServiceTest.php
index 8a5d0b14fc..6366d72af9 100644
--- a/tests/app/Services/UserServiceTest.php
+++ b/tests/app/Services/UserServiceTest.php
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees;
use Fisharebest\Webtrees\Contracts\CacheFactoryInterface;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Services\UserService;
use Symfony\Component\Cache\Adapter\NullAdapter;
@@ -143,7 +144,7 @@ class UserServiceTest extends TestCase
Auth::login($user);
$tree = $this->importTree('demo.ged');
$indi = $tree->createIndividual('0 @@ INDI');
- $tree->setUserPreference($user, User::PREF_TREE_ACCOUNT_XREF, $indi->xref());
+ $tree->setUserPreference($user, UserInterface::PREF_TREE_ACCOUNT_XREF, $indi->xref());
$users = $user_service->findByIndividual($indi);
@@ -178,7 +179,7 @@ class UserServiceTest extends TestCase
$user_service->create('user', 'User', 'user@example.com', 'secret');
$admin = $user_service->create('admin', 'Admin', 'admin@example.com', 'secret');
- $admin->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $admin->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
$users = $user_service->administrators();
@@ -199,10 +200,10 @@ class UserServiceTest extends TestCase
$user4 = $user_service->create('user4', 'User4', 'user4@example.com', 'secret');
$tree = $this->importTree('demo.ged');
- $tree->setUserPreference($user1, User::PREF_TREE_ROLE, User::ROLE_MANAGER);
- $tree->setUserPreference($user2, User::PREF_TREE_ROLE, User::ROLE_MODERATOR);
- $tree->setUserPreference($user3, User::PREF_TREE_ROLE, User::ROLE_EDITOR);
- $tree->setUserPreference($user4, User::PREF_TREE_ROLE, User::ROLE_MEMBER);
+ $tree->setUserPreference($user1, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_MANAGER);
+ $tree->setUserPreference($user2, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_MODERATOR);
+ $tree->setUserPreference($user3, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_EDITOR);
+ $tree->setUserPreference($user4, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_MEMBER);
$users = $user_service->managers();
@@ -223,10 +224,10 @@ class UserServiceTest extends TestCase
$user4 = $user_service->create('user4', 'User4', 'user4@example.com', 'secret');
$tree = $this->importTree('demo.ged');
- $tree->setUserPreference($user1, User::PREF_TREE_ROLE, User::ROLE_MANAGER);
- $tree->setUserPreference($user2, User::PREF_TREE_ROLE, User::ROLE_MODERATOR);
- $tree->setUserPreference($user3, User::PREF_TREE_ROLE, User::ROLE_EDITOR);
- $tree->setUserPreference($user4, User::PREF_TREE_ROLE, User::ROLE_MEMBER);
+ $tree->setUserPreference($user1, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_MANAGER);
+ $tree->setUserPreference($user2, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_MODERATOR);
+ $tree->setUserPreference($user3, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_EDITOR);
+ $tree->setUserPreference($user4, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_MEMBER);
$users = $user_service->moderators();
@@ -247,14 +248,14 @@ class UserServiceTest extends TestCase
$user3 = $user_service->create('user3', 'User3', 'user3@example.com', 'secret');
$user4 = $user_service->create('user4', 'User4', 'user4@example.com', 'secret');
- $user1->setPreference(User::PREF_IS_EMAIL_VERIFIED, '');
- $user1->setPreference(User::PREF_IS_ACCOUNT_APPROVED, '');
- $user2->setPreference(User::PREF_IS_EMAIL_VERIFIED, '');
- $user2->setPreference(User::PREF_IS_ACCOUNT_APPROVED, '1');
- $user3->setPreference(User::PREF_IS_EMAIL_VERIFIED, '1');
- $user3->setPreference(User::PREF_IS_ACCOUNT_APPROVED, '');
- $user4->setPreference(User::PREF_IS_EMAIL_VERIFIED, '1');
- $user4->setPreference(User::PREF_IS_ACCOUNT_APPROVED, '1');
+ $user1->setPreference(UserInterface::PREF_IS_EMAIL_VERIFIED, '');
+ $user1->setPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED, '');
+ $user2->setPreference(UserInterface::PREF_IS_EMAIL_VERIFIED, '');
+ $user2->setPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED, '1');
+ $user3->setPreference(UserInterface::PREF_IS_EMAIL_VERIFIED, '1');
+ $user3->setPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED, '');
+ $user4->setPreference(UserInterface::PREF_IS_EMAIL_VERIFIED, '1');
+ $user4->setPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED, '1');
$users = $user_service->unapproved();
diff --git a/tests/app/TreeTest.php b/tests/app/TreeTest.php
index d82733844e..b16fa4a20e 100644
--- a/tests/app/TreeTest.php
+++ b/tests/app/TreeTest.php
@@ -20,6 +20,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees;
use Fisharebest\Webtrees\Contracts\CacheFactoryInterface;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Functions\FunctionsImport;
use Fisharebest\Webtrees\Services\GedcomExportService;
use Fisharebest\Webtrees\Services\TreeService;
@@ -111,7 +112,7 @@ class TreeTest extends TestCase
$tree_service = new TreeService();
$tree = $tree_service->create('name', 'title');
$user = $user_service->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree->createIndividual("0 @@ FOO\n1 SEX U");
@@ -127,13 +128,13 @@ class TreeTest extends TestCase
$tree_service = new TreeService();
$tree = $tree_service->create('name', 'title');
$user = $user_service->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$record = $tree->createIndividual("0 @@ INDI\n1 SEX F\n1 NAME Foo /Bar/");
self::assertTrue($record->isPendingAddition());
- $user->setPreference(User::PREF_AUTO_ACCEPT_EDITS, '1');
+ $user->setPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS, '1');
$record = $tree->createIndividual("0 @@ INDI\n1 SEX F\n1 NAME Foo /Bar/");
self::assertFalse($record->isPendingAddition());
}
@@ -150,7 +151,7 @@ class TreeTest extends TestCase
$tree_service = new TreeService();
$tree = $tree_service->create('name', 'title');
$user = $user_service->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree->createFamily("0 @@ FOO\n1 MARR Y");
@@ -166,13 +167,13 @@ class TreeTest extends TestCase
$tree_service = new TreeService();
$tree = $tree_service->create('name', 'title');
$user = $user_service->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$record = $tree->createFamily("0 @@ FAM\n1 MARR Y");
self::assertTrue($record->isPendingAddition());
- $user->setPreference(User::PREF_AUTO_ACCEPT_EDITS, '1');
+ $user->setPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS, '1');
$record = $tree->createFamily("0 @@ FAM\n1 MARR Y");
self::assertFalse($record->isPendingAddition());
}
@@ -189,7 +190,7 @@ class TreeTest extends TestCase
$tree_service = new TreeService();
$tree = $tree_service->create('name', 'title');
$user = $user_service->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree->createMediaObject("0 @@ FOO\n1 MARR Y");
@@ -205,13 +206,13 @@ class TreeTest extends TestCase
$tree_service = new TreeService();
$tree = $tree_service->create('name', 'title');
$user = $user_service->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$record = $tree->createMediaObject("0 @@ OBJE\n1 FILE foo.jpeg");
self::assertTrue($record->isPendingAddition());
- $user->setPreference(User::PREF_AUTO_ACCEPT_EDITS, '1');
+ $user->setPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS, '1');
$record = $tree->createMediaObject("0 @@ OBJE\n1 FILE foo.jpeg");
self::assertFalse($record->isPendingAddition());
}
@@ -228,7 +229,7 @@ class TreeTest extends TestCase
$tree_service = new TreeService();
$tree = $tree_service->create('name', 'title');
$user = $user_service->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$tree->createRecord("0 @@FOO\n1 NOTE noted");
@@ -244,13 +245,13 @@ class TreeTest extends TestCase
$tree_service = new TreeService();
$tree = $tree_service->create('name', 'title');
$user = $user_service->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$record = $tree->createRecord("0 @@ FOO\n1 NOTE noted");
self::assertTrue($record->isPendingAddition());
- $user->setPreference(User::PREF_AUTO_ACCEPT_EDITS, '1');
+ $user->setPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS, '1');
$record = $tree->createRecord("0 @@ FOO\n1 NOTE noted");
self::assertFalse($record->isPendingAddition());
}
@@ -265,7 +266,7 @@ class TreeTest extends TestCase
$tree_service = new TreeService();
$tree = $tree_service->create('name', 'title');
$user = $user_service->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_AUTO_ACCEPT_EDITS, '1');
+ $user->setPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS, '1');
Auth::login($user);
// Delete the tree's default individual.
@@ -287,11 +288,11 @@ class TreeTest extends TestCase
self::assertSame($record2->xref(), $tree->significantIndividual($user)->xref());
// User preference
- $tree->setUserPreference($user, User::PREF_TREE_ACCOUNT_XREF, $record3->xref());
+ $tree->setUserPreference($user, UserInterface::PREF_TREE_ACCOUNT_XREF, $record3->xref());
self::assertSame($record3->xref(), $tree->significantIndividual($user)->xref());
// User record
- $tree->setUserPreference($user, User::PREF_TREE_DEFAULT_XREF, $record4->xref());
+ $tree->setUserPreference($user, UserInterface::PREF_TREE_DEFAULT_XREF, $record4->xref());
self::assertSame($record4->xref(), $tree->significantIndividual($user)->xref());
}
@@ -322,14 +323,14 @@ class TreeTest extends TestCase
$user_service = new UserService();
$tree = $this->importTree('demo.ged');
$user = $user_service->create('admin', 'Administrator', 'admin@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
- $user->setPreference(User::PREF_AUTO_ACCEPT_EDITS, '1');
+ $user->setPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS, '1');
$tree->createIndividual("0 @@ INDI\n1 SEX F\n1 NAME Foo /Bar/");
self::assertFalse($tree->hasPendingEdit());
- $user->setPreference(User::PREF_AUTO_ACCEPT_EDITS, '');
+ $user->setPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS, '');
$tree->createIndividual("0 @@ INDI\n1 SEX F\n1 NAME Foo /Bar/");
self::assertTrue($tree->hasPendingEdit());
}
diff --git a/tests/feature/EmbeddedVariablesTest.php b/tests/feature/EmbeddedVariablesTest.php
index d8433eb2b8..bb6dbb764e 100644
--- a/tests/feature/EmbeddedVariablesTest.php
+++ b/tests/feature/EmbeddedVariablesTest.php
@@ -19,6 +19,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Services\ModuleService;
use Fisharebest\Webtrees\Services\TreeService;
use Fisharebest\Webtrees\Services\UserService;
@@ -81,7 +82,7 @@ class EmbeddedVariablesTest extends TestCase
// As member
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$text = $statistics->embedTags('#getAllTagsTable#');
@@ -103,7 +104,7 @@ class EmbeddedVariablesTest extends TestCase
// As member
$user = (new UserService())->create('user', 'User', 'user@example.com', 'secret');
- $user->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
Auth::login($user);
$text = $statistics->embedTags('#getAllTagsTable#');
diff --git a/tests/feature/Privacy.php b/tests/feature/Privacy.php
index 154e012b1d..11c7d09fed 100644
--- a/tests/feature/Privacy.php
+++ b/tests/feature/Privacy.php
@@ -19,6 +19,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees;
+use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Services\UserService;
use function strip_tags;
@@ -57,22 +58,22 @@ class Privacy extends TestCase
$user_service = new UserService();
$admin = $user_service->create('admin', 'admin', 'admin', '*');
- $admin->setPreference(User::PREF_IS_ADMINISTRATOR, '1');
+ $admin->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1');
$manager = $user_service->create('manager', 'manager', 'manager', '*');
- $tree->setUserPreference($manager, User::PREF_TREE_ROLE, User::ROLE_MANAGER);
+ $tree->setUserPreference($manager, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_MANAGER);
$moderator = $user_service->create('moderator', 'moderator', 'moderator', '*');
- $tree->setUserPreference($moderator, User::PREF_TREE_ROLE, User::ROLE_MODERATOR);
+ $tree->setUserPreference($moderator, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_MODERATOR);
$editor = $user_service->create('editor', 'editor', 'editor', '*');
- $tree->setUserPreference($editor, User::PREF_TREE_ROLE, User::ROLE_EDITOR);
+ $tree->setUserPreference($editor, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_EDITOR);
$member = $user_service->create('member', 'member', 'member', '*');
- $tree->setUserPreference($member, User::PREF_TREE_ROLE, User::ROLE_MEMBER);
+ $tree->setUserPreference($member, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_MEMBER);
$visitor = $user_service->create('visitor', 'visitor', 'visitor', '*');
- $tree->setUserPreference($visitor, User::PREF_TREE_ROLE, User::ROLE_VISITOR);
+ $tree->setUserPreference($visitor, UserInterface::PREF_TREE_ROLE, UserInterface::ROLE_VISITOR);
// Enable privacy functions
$tree->setPreference('HIDE_LIVE_PEOPLE', '1');
@@ -154,10 +155,10 @@ class Privacy extends TestCase
// Relationship privacy
Auth::login($member);
self::assertTrue($beatrice->canShow());
- $tree->setUserPreference($member, User::PREF_TREE_ACCOUNT_XREF, $savannah->xref());
- $tree->setUserPreference($member, User::PREF_TREE_PATH_LENGTH, '3');
+ $tree->setUserPreference($member, UserInterface::PREF_TREE_ACCOUNT_XREF, $savannah->xref());
+ $tree->setUserPreference($member, UserInterface::PREF_TREE_PATH_LENGTH, '3');
self::assertFalse($beatrice->canShow());
- $tree->setUserPreference($member, User::PREF_TREE_PATH_LENGTH, '4');
+ $tree->setUserPreference($member, UserInterface::PREF_TREE_PATH_LENGTH, '4');
self::assertTrue($beatrice->canShow());
}
}