/webtrees/tests/app/ |
H A D | TreeTest.php | 84 … $user = $user_service->create('user', 'User', 'user@example.com', 'secret'); 86 $pref = $tree->getUserPreference($user, 'foo', 'default'); 89 $tree->setUserPreference($user, 'foo', 'bar'); 90 $pref = $tree->getUserPreference($user, 'foo', 'default'); 102 … $user = $user_service->create('user', 'User', 'user@example.com', 'secret'); 103 $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); 104 Auth::login($user); 115 … $user = $user_service->create('user', 'User', 'user@example.com', 'secret'); 116 $user->setPreference(UserInterface::PREF_IS_ADMINISTRATOR, '1'); 117 Auth::login($user); [all …]
|
H A D | UserTest.php | 47 $user = new User(123, 'username', 'real name', 'email'); 49 self::assertInstanceOf(UserInterface::class, $user); 50 self::assertSame(123, $user->id()); 51 self::assertSame('email', $user->email()); 52 self::assertSame('real name', $user->realName()); 53 self::assertSame('username', $user->userName()); 59 $user = $user_service->create('user', 'User', 'user@example.com', 'secret'); 61 self::assertSame(1, $user->id()); 63 self::assertSame('user', $user->userName()); 64 $user->setUserName('foo'); [all …]
|
H A D | GuestUserTest.php | 30 $user = new GuestUser(); 32 self::assertInstanceOf(UserInterface::class, $user); 33 self::assertSame(0, $user->id()); 34 self::assertSame('GUEST_USER', $user->email()); 35 self::assertSame('GUEST_USER', $user->realName()); 36 self::assertSame('', $user->userName()); 41 $user = new GuestUser('guest@example.com', 'guest user'); 43 self::assertInstanceOf(UserInterface::class, $user); 44 self::assertSame(0, $user->id()); 45 self::assertSame('guest@example.com', $user->email()); [all …]
|
H A D | NoReplyUserTest.php | 32 $user = new NoReplyUser(); 34 self::assertInstanceOf(UserInterface::class, $user); 35 self::assertSame(0, $user->id()); 36 self::assertSame('no-reply@localhost', $user->email()); 37 self::assertSame(Webtrees::NAME, $user->realName()); 38 self::assertSame('', $user->userName()); 43 $user = new NoReplyUser(); 45 self::assertSame('', $user->getPreference('foo')); 46 self::assertSame('', $user->getPreference('foo')); 47 self::assertSame('bar', $user->getPreference('foo', 'bar')); [all …]
|
H A D | SiteUserTest.php | 32 $user = new SiteUser(); 36 self::assertInstanceOf(UserInterface::class, $user); 37 self::assertSame(0, $user->id()); 38 self::assertSame('email@example.com', $user->email()); 39 self::assertSame('My site', $user->realName()); 40 self::assertSame('', $user->userName()); 45 $user = new SiteUser(); 47 self::assertSame('', $user->getPreference('foo')); 48 self::assertSame('', $user->getPreference('foo')); 49 self::assertSame('bar', $user->getPreference('foo', 'bar')); [all …]
|
H A D | DefaultUserTest.php | 46 $user = new DefaultUser(); 48 self::assertInstanceOf(UserInterface::class, $user); 49 self::assertSame(-1, $user->id()); 50 self::assertSame('DEFAULT_USER', $user->email()); 51 self::assertSame('DEFAULT_USER', $user->realName()); 52 self::assertSame('', $user->userName()); 57 $user = new DefaultUser(); 59 self::assertSame('', $user->getPreference('foo')); 60 self::assertSame('', $user->getPreference('foo')); 61 self::assertSame('bar', $user->getPreference('foo', 'bar')); [all …]
|
H A D | TreeUserTest.php | 37 $user = new TreeUser($tree); 39 self::assertInstanceOf(UserInterface::class, $user); 40 self::assertSame(0, $user->id()); 41 self::assertSame('', $user->email()); 42 self::assertSame('title', $user->realName()); 43 self::assertSame('', $user->userName()); 51 $user = new TreeUser($tree); 53 self::assertSame('', $user->getPreference('foo')); 54 self::assertSame('', $user->getPreference('foo')); 55 self::assertSame('bar', $user->getPreference('foo', 'bar')); [all …]
|
/webtrees/app/ |
H A D | Auth.php | 54 * @param UserInterface|null $user 58 public static function isAdmin(UserInterface|null $user = null): bool argument 60 $user ??= self::user(); 62 return $user->getPreference(UserInterface::PREF_IS_ADMINISTRATOR) === '1'; 69 * @param UserInterface|null $user 73 public static function isManager(Tree $tree, UserInterface|null $user = null): bool argument 75 $user ??= self::user(); 77 …return self::isAdmin($user) || $tree->getUserPreference($user, UserInterface::PREF_TREE_ROLE) === … 84 * @param UserInterface|null $user 88 public static function isModerator(Tree $tree, UserInterface|null $user = null): bool argument [all …]
|
H A D | Tree.php | 263 * @param UserInterface $user 269 …public function setUserPreference(UserInterface $user, string $setting_name, string $setting_value… argument 271 if ($this->getUserPreference($user, $setting_name) !== $setting_value) { 275 'user_id' => $user->id(), 282 $this->user_preferences[$user->id()][$setting_name] = $setting_value; 284 …ce "' . $setting_name . '" set to "' . $setting_value . '" for user "' . $user->userName() . '"', … 293 * @param UserInterface $user 299 …public function getUserPreference(UserInterface $user, string $setting_name, string $default = '')… argument 303 if (!array_key_exists($user->id(), $this->user_preferences)) { 304 $this->user_preferences[$user->id()] = DB::table('user_gedcom_setting') [all …]
|
/webtrees/app/Statistics/Repository/ |
H A D | UserRepository.php | 70 foreach ($this->user_service->allLoggedIn() as $user) { 71 … if (Auth::isAdmin() || $user->getPreference(UserInterface::PREF_IS_VISIBLE_ONLINE) === '1') { 72 $logged_in[] = $user; 105 foreach ($logged_in as $user) { 110 …ual = Registry::individualFactory()->make($this->tree->getUserPreference($user, UserInterface::PRE… 113 … $content .= '<a href="' . e($individual->url()) . '">' . e($user->realName()) . '</a>'; 115 $content .= e($user->realName()); 118 $content .= ' - ' . e($user->userName()); 120 …if ($user->getPreference(UserInterface::PREF_CONTACT_METHOD) !== MessageService::CONTACT_METHOD_NO… 121 …$content .= '<a href="' . e(route(MessagePage::class, ['to' => $user->userName(), 'tree' => $this-… [all …]
|
H A D | LatestUserRepository.php | 68 static $user; 70 if ($user instanceof UserInterface) { 71 return $user; 89 return $this->user_service->find($user_id) ?? Auth::user(); 116 $user = $this->latestUserQuery(); 117 $timestamp = (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERED); 130 $user = $this->latestUserQuery(); 132 return date($format, (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERED)); 145 $user = $this->latestUserQuery(); 149 ->where('user_id', '=', $user->id())
|
/webtrees/resources/views/admin/ |
H A D | users-edit.phtml | 38 <input type="hidden" name="user_id" value="<?= $user->id() ?>"> 46 …l_name" name="real_name" required="required" maxlength="64" value="<?= e($user->realName()) ?>" di… 59 …sername" name="username" required="required" maxlength="32" value="<?= e($user->userName()) ?>" di… 72 … character.', 'Use at least %s characters.', 8, I18N::number(8)) ?>" <?= $user->id() ? '' : 'requi… 85 …email" id="email" name="email" required="required" maxlength="64" value="<?= e($user->email()) ?>"> 101 …<input type="checkbox" name="verified" value="1" <?= $user->getPreference(UserInterface::PREF_IS_E… 105 …<input type="checkbox" name="approved" value="1" <?= $user->getPreference(UserInterface::PREF_IS_A… 130 …<?= view('components/select', ['name' => 'language', 'selected' => $user->getPreference(UserInterf… 140 …<?= view('components/select', ['name' => 'timezone', 'selected' => $user->getPreference(UserInterf… 155 …<input type="checkbox" name="auto_accept" value="1" <?= $user->getPreference(UserInterface::PREF_A… [all …]
|
H A D | users-cleanup.phtml | 32 <?php foreach ($inactive_users as $user) : ?> 35 …<input type="checkbox" name="delete[]" value="<?= $user->id() ?>" aria-label="<?= e($user->userNam… 38 <a href="<?= e(route(UserEditPage::class, ['user_id' => $user->id()])) ?>"> 39 <?= e($user->userName()) ?> 41 <bdi><?= e($user->realName()) ?></bdi> 46 …y::timestampFactory()->make(max((int) $user->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERE… 51 <?php foreach ($unverified_users as $user) : ?> 54 …<input type="checkbox" name="delete[]" value="<?= $user->id() ?>" aria-label="<?= e($user->userNam… 57 <a href="<?= e(route(UserEditPage::class, ['user_id' => $user->id()])) ?>"> 58 <?= e($user->userName()) ?> [all …]
|
/webtrees/tests/app/Services/ |
H A D | RateLimitServiceTest.php | 40 $user = new GuestUser(); 44 $rate_limit_service->limitRateForUser($user, 1000, 30, 'rate-limit'); 51 $user = new GuestUser(); 53 $rate_limit_service->limitRateForUser($user, 3, 30, 'rate-limit'); 54 $history = $user->getPreference('rate-limit'); 57 $rate_limit_service->limitRateForUser($user, 3, 30, 'rate-limit'); 58 $history = $user->getPreference('rate-limit'); 61 $rate_limit_service->limitRateForUser($user, 3, 30, 'rate-limit'); 62 $history = $user->getPreference('rate-limit'); 70 $user = new GuestUser(); [all …]
|
/webtrees/app/Http/RequestHandlers/ |
H A D | RegisterAction.php | 126 $user = $this->user_service->create($username, $realname, $email, $password); 129 $user->setPreference(UserInterface::PREF_LANGUAGE, I18N::languageTag()); 130 $user->setPreference(UserInterface::PREF_TIME_ZONE, Site::getPreference('TIMEZONE')); 131 $user->setPreference(UserInterface::PREF_IS_EMAIL_VERIFIED, ''); 132 $user->setPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED, ''); 133 $user->setPreference(UserInterface::PREF_TIMESTAMP_REGISTERED, date('U')); 134 $user->setPreference(UserInterface::PREF_VERIFICATION_TOKEN, $token); 135 …$user->setPreference(UserInterface::PREF_CONTACT_METHOD, MessageService::CONTACT_METHOD_INTERNAL_A… 136 $user->setPreference(UserInterface::PREF_NEW_ACCOUNT_COMMENT, $comments); 137 $user->setPreference(UserInterface::PREF_IS_VISIBLE_ONLINE, '1'); [all …]
|
H A D | AccountUpdate.php | 61 $user = Validator::attributes($request)->user(); 63 assert($user instanceof User); 76 $user->setPassword($password); 80 if ($user_name !== $user->userName()) { 82 $user->setUserName($user_name); 89 if ($email !== $user->email()) { 91 $user->setEmail($email); 97 $user->setRealName($real_name); 98 $user->setPreference(UserInterface::PREF_CONTACT_METHOD, $contact_method); 99 $user->setPreference(UserInterface::PREF_LANGUAGE, $language); [all …]
|
H A D | LoginAction.php | 111 $user = $this->user_service->findByIdentifier($username); 113 if ($user === null) { 118 if (!$user->checkPassword($password)) { 123 if ($user->getPreference(UserInterface::PREF_IS_EMAIL_VERIFIED) !== '1') { 128 if ($user->getPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED) !== '1') { 133 Auth::login($user); 134 … Log::addAuthenticationLog('Login: ' . Auth::user()->userName() . '/' . Auth::user()->realName()); 135 Auth::user()->setPreference(UserInterface::PREF_TIMESTAMP_ACTIVE, (string) time()); 137 Session::put('language', Auth::user()->getPreference(UserInterface::PREF_LANGUAGE)); 138 Session::put('theme', Auth::user()->getPreference(UserInterface::PREF_THEME)); [all …]
|
/webtrees/app/Module/ |
H A D | UserFavoritesModule.php | 74 'favorites' => $this->getFavorites($tree, Auth::user()), 127 * @param UserInterface $user 131 public function getFavorites(Tree $tree, UserInterface $user): array argument 135 ->where('user_id', '=', $user->id()) 162 $user = Validator::attributes($request)->user(); 172 $this->addUrlFavorite($tree, $user, $url, $title ?: $url, $note); 176 $this->addRecordFavorite($tree, $user, $record, $note); 193 $user = Validator::attributes($request)->user(); 199 ->where('user_id', '=', $user->id()) 210 * @param UserInterface $user [all …]
|
/webtrees/app/Cli/Commands/ |
H A D | UserList.php | 53 foreach ($users as $user) { 54 … $registered = (int) $user->getPreference(setting_name: UserInterface::PREF_TIMESTAMP_REGISTERED); 55 … $last_login = (int) $user->getPreference(setting_name: UserInterface::PREF_TIMESTAMP_ACTIVE); 70 $user->id(), 71 $user->userName(), 72 $user->realName(), 73 $user->email(), 74 Auth::isAdmin(user: $user) ? 'Yes' : 'No', 75 … $user->getPreference(setting_name: UserInterface::PREF_IS_ACCOUNT_APPROVED) ? 'Yes' : 'No', 76 … $user->getPreference(setting_name: UserInterface::PREF_IS_EMAIL_VERIFIED) ? 'Yes' : 'No', [all …]
|
H A D | UserCreate.php | 93 $user = $this->user_service->findByUserName(user_name: $username); 95 if ($user !== null) { 101 $user = $this->user_service->findByEmail(email: $email); 103 if ($user !== null) { 114 …$user = $this->user_service->create(user_name: $username, real_name:$realname, email: $email, pass… 115 $user->setPreference(setting_name: UserInterface::PREF_TIME_ZONE, setting_value: $timezone); 116 $user->setPreference(setting_name: UserInterface::PREF_LANGUAGE, setting_value: $language); 117 … $user->setPreference(setting_name: UserInterface::PREF_IS_ACCOUNT_APPROVED, setting_value: '1'); 118 … $user->setPreference(setting_name: UserInterface::PREF_IS_EMAIL_VERIFIED, setting_value: '1'); 119 …$user->setPreference(setting_name: UserInterface::PREF_CONTACT_METHOD, setting_value: 'messaging'); [all …]
|
/webtrees/app/Services/ |
H A D | UserService.php | 158 return static function (UserInterface $user) use ($timestamp): bool { 159 $registered_at = (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERED); 160 $logged_in_at = (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_ACTIVE); 332 * @param User $user 336 public function delete(User $user): void 340 ->where('user_id', '=', $user->id()) 345 ->where('user_id', '=', $user->id()) 350 ->where('user_id', '=', $user->id()) 356 ->where('user_id', '=', $user->id()) 359 DB::table('block')->where('user_id', '=', $user->id())->delete(); [all …]
|
H A D | HomePageService.php | 84 * @param UserInterface $user 88 …public function userBlock(ServerRequestInterface $request, UserInterface $user): ModuleBlockInterf… argument 94 ->where('user_id', '=', $user->id()) 119 …_blocks = $this->module_service->findByComponent(ModuleBlockInterface::class, $tree, Auth::user()); 138 * @param UserInterface $user 142 public function availableTreeBlocks(Tree $tree, UserInterface $user): Collection argument 144 return $this->module_service->findByComponent(ModuleBlockInterface::class, $tree, $user) 153 * @param UserInterface $user 157 public function availableUserBlocks(Tree $tree, UserInterface $user): Collection argument 159 return $this->module_service->findByComponent(ModuleBlockInterface::class, $tree, $user) [all …]
|
H A D | MessageService.php | 120 'sender' => Auth::check() ? Auth::user()->email() : $sender->email(), 148 * @param UserInterface $user 152 public function sendInternalMessage(UserInterface $user): bool argument 154 return in_array($user->getPreference(UserInterface::PREF_CONTACT_METHOD), [ 165 * @param UserInterface $user 169 public function sendEmail(UserInterface $user): bool argument 171 return in_array($user->getPreference(UserInterface::PREF_CONTACT_METHOD), [ 194 …user): bool => $user->getPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED) === '1' && $user->get… 198 …return $this->user_service->all()->filter(static function (UserInterface $user) use ($six_months_a… 199 … $session_time = (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_ACTIVE);
|
/webtrees/app/Factories/ |
H A D | TimestampFactory.php | 42 * @param UserInterface|null $user 46 public function make(int $timestamp, UserInterface|null $user = null): TimestampInterface argument 48 $user ??= Auth::user(); 49 … $timezone = $user->getPreference(UserInterface::PREF_TIME_ZONE, Site::getPreference('TIMEZONE')); 58 * @param UserInterface|null $user 62 …(string|null $string, string $format = 'Y-m-d H:i:s', UserInterface|null $user = null): TimestampI… argument 71 return $this->make($timestamp->getTimestamp(), $user); 75 * @param UserInterface|null $user 79 public function now(UserInterface|null $user = null): TimestampInterface argument 81 return $this->make(time(), $user);
|
/webtrees/resources/views/modules/user-messages/ |
H A D | user-messages.phtml | 36 <?php foreach ($users as $user) : ?> 37 <option value="<?= e($user->userName()) ?>"> 38 <?= e($user->realName()) ?> - <?= e($user->userName()) ?> 93 <?php $user = $user_service->findByIdentifier($message->sender) ?> variable 95 <?php if ($user instanceof User) : ?> 96 … <bdi><?= e($user->realName()) ?></bdi> - <bdi><?= $user->email() ?></bdi> 118 if ($user instanceof User) { 121 'to' => $user->userName(),
|