1b08296eeSGreg Roach<?php 23976b470SGreg Roach 3b08296eeSGreg Roach/** 4b08296eeSGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 6b08296eeSGreg Roach * This program is free software: you can redistribute it and/or modify 7b08296eeSGreg Roach * it under the terms of the GNU General Public License as published by 8b08296eeSGreg Roach * the Free Software Foundation, either version 3 of the License, or 9b08296eeSGreg Roach * (at your option) any later version. 10b08296eeSGreg Roach * This program is distributed in the hope that it will be useful, 11b08296eeSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12b08296eeSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13b08296eeSGreg Roach * GNU General Public License for more details. 14b08296eeSGreg Roach * You should have received a copy of the GNU General Public License 1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 16b08296eeSGreg Roach */ 17fcfa147eSGreg Roach 18b08296eeSGreg Roachdeclare(strict_types=1); 19b08296eeSGreg Roach 20e5a6b4d4SGreg Roachnamespace Fisharebest\Webtrees\Contracts; 21b08296eeSGreg Roach 22b08296eeSGreg Roach/** 23b3a775f6SGreg Roach * behavior required of a user object. 24b08296eeSGreg Roach */ 25e5a6b4d4SGreg Roachinterface UserInterface 26b08296eeSGreg Roach{ 271fe542e9SGreg Roach // For historic reasons, user preferences have inconsistent and confusing names. 281fe542e9SGreg Roach public const PREF_AUTO_ACCEPT_EDITS = 'auto_accept'; 291fe542e9SGreg Roach public const PREF_CONTACT_METHOD = 'contactmethod'; 301fe542e9SGreg Roach public const PREF_IS_ACCOUNT_APPROVED = 'verified_by_admin'; 311fe542e9SGreg Roach public const PREF_IS_ADMINISTRATOR = 'canadmin'; 321fe542e9SGreg Roach public const PREF_IS_EMAIL_VERIFIED = 'verified'; 331fe542e9SGreg Roach public const PREF_IS_VISIBLE_ONLINE = 'visibleonline'; 341fe542e9SGreg Roach public const PREF_LANGUAGE = 'language'; 351fe542e9SGreg Roach public const PREF_NEW_ACCOUNT_COMMENT = 'comment'; 361fe542e9SGreg Roach public const PREF_TIMESTAMP_REGISTERED = 'reg_timestamp'; 371fe542e9SGreg Roach public const PREF_TIMESTAMP_ACTIVE = 'sessiontime'; 381fe542e9SGreg Roach public const PREF_TIME_ZONE = 'TIMEZONE'; 391fe542e9SGreg Roach public const PREF_THEME = 'theme'; 401fe542e9SGreg Roach public const PREF_VERIFICATION_TOKEN = 'reg_hashcode'; 411fe542e9SGreg Roach 421fe542e9SGreg Roach // For historic reasons, user-tree preferences have inconsistent and confusing names. 431fe542e9SGreg Roach public const PREF_TREE_ACCOUNT_XREF = 'gedcomid'; 441fe542e9SGreg Roach public const PREF_TREE_DEFAULT_XREF = 'rootid'; 451fe542e9SGreg Roach public const PREF_TREE_PATH_LENGTH = 'RELATIONSHIP_PATH_LENGTH'; 461fe542e9SGreg Roach public const PREF_TREE_ROLE = 'canedit'; 471fe542e9SGreg Roach 481fe542e9SGreg Roach // For historic reasons, roles have inconsistent and confusing names. 491fe542e9SGreg Roach public const ROLE_VISITOR = 'none'; 501fe542e9SGreg Roach public const ROLE_MEMBER = 'access'; 511fe542e9SGreg Roach public const ROLE_EDITOR = 'edit'; 521fe542e9SGreg Roach public const ROLE_MODERATOR = 'accept'; 531fe542e9SGreg Roach public const ROLE_MANAGER = 'admin'; 541fe542e9SGreg Roach 55b08296eeSGreg Roach /** 56e5a6b4d4SGreg Roach * The user‘s internal identifier 57b08296eeSGreg Roach * 58b08296eeSGreg Roach * @return int 59b08296eeSGreg Roach */ 60e5a6b4d4SGreg Roach public function id(): int; 61b08296eeSGreg Roach 62b08296eeSGreg Roach /** 63e5a6b4d4SGreg Roach * The users email address. 64b08296eeSGreg Roach * 65b08296eeSGreg Roach * @return string 66b08296eeSGreg Roach */ 67e5a6b4d4SGreg Roach public function email(): string; 68b08296eeSGreg Roach 69b08296eeSGreg Roach /** 70e5a6b4d4SGreg Roach * The user‘s real name. 71b08296eeSGreg Roach * 72b08296eeSGreg Roach * @return string 73b08296eeSGreg Roach */ 74e5a6b4d4SGreg Roach public function realName(): string; 75b08296eeSGreg Roach 76b08296eeSGreg Roach /** 77e5a6b4d4SGreg Roach * The user‘s login name. 78b08296eeSGreg Roach * 79b08296eeSGreg Roach * @return string 80b08296eeSGreg Roach */ 81e5a6b4d4SGreg Roach public function userName(): string; 82b08296eeSGreg Roach 83b08296eeSGreg Roach /** 84b08296eeSGreg Roach * @param string $setting_name 85b08296eeSGreg Roach * @param string $default 86b08296eeSGreg Roach * 87b08296eeSGreg Roach * @return string 88b08296eeSGreg Roach */ 89e5a6b4d4SGreg Roach public function getPreference(string $setting_name, string $default = ''): string; 90b08296eeSGreg Roach 91b08296eeSGreg Roach /** 92b08296eeSGreg Roach * @param string $setting_name 93b08296eeSGreg Roach * @param string $setting_value 94b08296eeSGreg Roach * 957c4add84SGreg Roach * @return void 96b08296eeSGreg Roach */ 977c4add84SGreg Roach public function setPreference(string $setting_name, string $setting_value): void; 98b08296eeSGreg Roach} 99