1<?php 2 3/** 4 * webtrees: online genealogy 5 * Copyright (C) 2023 webtrees development team 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18declare(strict_types=1); 19 20namespace Fisharebest\Webtrees\Contracts; 21 22/** 23 * behavior required of a user object. 24 */ 25interface UserInterface 26{ 27 // For historic reasons, user preferences have inconsistent and confusing names. 28 public const string PREF_AUTO_ACCEPT_EDITS = 'auto_accept'; 29 public const string PREF_CONTACT_METHOD = 'contactmethod'; 30 public const string PREF_IS_ACCOUNT_APPROVED = 'verified_by_admin'; 31 public const string PREF_IS_ADMINISTRATOR = 'canadmin'; 32 public const string PREF_IS_EMAIL_VERIFIED = 'verified'; 33 public const string PREF_IS_VISIBLE_ONLINE = 'visibleonline'; 34 public const string PREF_LANGUAGE = 'language'; 35 public const string PREF_NEW_ACCOUNT_COMMENT = 'comment'; 36 public const string PREF_TIMESTAMP_REGISTERED = 'reg_timestamp'; 37 public const string PREF_TIMESTAMP_ACTIVE = 'sessiontime'; 38 public const string PREF_TIME_ZONE = 'TIMEZONE'; 39 public const string PREF_THEME = 'theme'; 40 public const string PREF_VERIFICATION_TOKEN = 'reg_hashcode'; 41 42 // For historic reasons, user-tree preferences have inconsistent and confusing names. 43 public const string PREF_TREE_ACCOUNT_XREF = 'gedcomid'; 44 public const string PREF_TREE_DEFAULT_XREF = 'rootid'; 45 public const string PREF_TREE_PATH_LENGTH = 'RELATIONSHIP_PATH_LENGTH'; 46 public const string PREF_TREE_ROLE = 'canedit'; 47 48 // For historic reasons, roles have inconsistent and confusing names. 49 public const string ROLE_VISITOR = 'none'; 50 public const string ROLE_MEMBER = 'access'; 51 public const string ROLE_EDITOR = 'edit'; 52 public const string ROLE_MODERATOR = 'accept'; 53 public const string ROLE_MANAGER = 'admin'; 54 55 /** 56 * The user‘s internal identifier 57 * 58 * @return int 59 */ 60 public function id(): int; 61 62 /** 63 * The users email address. 64 * 65 * @return string 66 */ 67 public function email(): string; 68 69 /** 70 * The user‘s real name. 71 * 72 * @return string 73 */ 74 public function realName(): string; 75 76 /** 77 * The user‘s login name. 78 * 79 * @return string 80 */ 81 public function userName(): string; 82 83 /** 84 * @param string $setting_name 85 * @param string $default 86 * 87 * @return string 88 */ 89 public function getPreference(string $setting_name, string $default = ''): string; 90 91 /** 92 * @param string $setting_name 93 * @param string $setting_value 94 * 95 * @return void 96 */ 97 public function setPreference(string $setting_name, string $setting_value): void; 98} 99