aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/lib/Settings/Personal
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings/lib/Settings/Personal')
-rw-r--r--apps/settings/lib/Settings/Personal/Additional.php5
-rw-r--r--apps/settings/lib/Settings/Personal/PersonalInfo.php73
-rw-r--r--apps/settings/lib/Settings/Personal/Security/Authtokens.php34
-rw-r--r--apps/settings/lib/Settings/Personal/Security/Password.php16
-rw-r--r--apps/settings/lib/Settings/Personal/Security/TwoFactor.php22
-rw-r--r--apps/settings/lib/Settings/Personal/Security/WebAuthn.php23
-rw-r--r--apps/settings/lib/Settings/Personal/ServerDevNotice.php43
7 files changed, 63 insertions, 153 deletions
diff --git a/apps/settings/lib/Settings/Personal/Additional.php b/apps/settings/lib/Settings/Personal/Additional.php
index 96de4f20c51..58fe08a63b7 100644
--- a/apps/settings/lib/Settings/Personal/Additional.php
+++ b/apps/settings/lib/Settings/Personal/Additional.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@@ -28,8 +29,8 @@ class Additional implements ISettings {
/**
* @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
+ * the admin section. The forms are arranged in ascending order of the
+ * priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
* @since 9.1
diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php
index 1c34bc52d40..9a12b18bb5e 100644
--- a/apps/settings/lib/Settings/Personal/PersonalInfo.php
+++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php
@@ -11,6 +11,7 @@ namespace OCA\Settings\Settings\Personal;
use OC\Profile\ProfileManager;
use OCA\FederatedFileSharing\FederatedShareProvider;
+use OCA\Provisioning_API\Controller\AUserDataOCSController;
use OCP\Accounts\IAccount;
use OCP\Accounts\IAccountManager;
use OCP\Accounts\IAccountProperty;
@@ -26,62 +27,28 @@ use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
use OCP\Notification\IManager;
+use OCP\Server;
use OCP\Settings\ISettings;
+use OCP\Util;
class PersonalInfo implements ISettings {
- /** @var IConfig */
- private $config;
-
- /** @var IUserManager */
- private $userManager;
-
- /** @var IAccountManager */
- private $accountManager;
-
/** @var ProfileManager */
private $profileManager;
- /** @var IGroupManager */
- private $groupManager;
-
- /** @var IAppManager */
- private $appManager;
-
- /** @var IFactory */
- private $l10nFactory;
-
- /** @var IL10N */
- private $l;
-
- /** @var IInitialState */
- private $initialStateService;
-
- /** @var IManager */
- private $manager;
-
public function __construct(
- IConfig $config,
- IUserManager $userManager,
- IGroupManager $groupManager,
- IAccountManager $accountManager,
+ private IConfig $config,
+ private IUserManager $userManager,
+ private IGroupManager $groupManager,
+ private IAccountManager $accountManager,
ProfileManager $profileManager,
- IAppManager $appManager,
- IFactory $l10nFactory,
- IL10N $l,
- IInitialState $initialStateService,
- IManager $manager
+ private IAppManager $appManager,
+ private IFactory $l10nFactory,
+ private IL10N $l,
+ private IInitialState $initialStateService,
+ private IManager $manager,
) {
- $this->config = $config;
- $this->userManager = $userManager;
- $this->accountManager = $accountManager;
$this->profileManager = $profileManager;
- $this->groupManager = $groupManager;
- $this->appManager = $appManager;
- $this->l10nFactory = $l10nFactory;
- $this->l = $l;
- $this->initialStateService = $initialStateService;
- $this->manager = $manager;
}
public function getForm(): TemplateResponse {
@@ -90,7 +57,7 @@ class PersonalInfo implements ISettings {
$lookupServerUploadEnabled = false;
if ($federatedFileSharingEnabled) {
/** @var FederatedShareProvider $shareProvider */
- $shareProvider = \OC::$server->query(FederatedShareProvider::class);
+ $shareProvider = Server::get(FederatedShareProvider::class);
$lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled();
}
@@ -105,7 +72,7 @@ class PersonalInfo implements ISettings {
if ($storageInfo['quota'] === FileInfo::SPACE_UNLIMITED) {
$totalSpace = $this->l->t('Unlimited');
} else {
- $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
+ $totalSpace = Util::humanFileSize($storageInfo['total']);
}
$messageParameters = $this->getMessageParameters($account);
@@ -122,7 +89,7 @@ class PersonalInfo implements ISettings {
'groups' => $this->getGroups($user),
'quota' => $storageInfo['quota'],
'totalSpace' => $totalSpace,
- 'usage' => \OC_Helper::humanFileSize($storageInfo['used']),
+ 'usage' => Util::humanFileSize($storageInfo['used']),
'usageRelative' => round($storageInfo['relative']),
'displayName' => $this->getProperty($account, IAccountManager::PROPERTY_DISPLAYNAME),
'emailMap' => $this->getEmailMap($account),
@@ -131,6 +98,7 @@ class PersonalInfo implements ISettings {
'location' => $this->getProperty($account, IAccountManager::PROPERTY_ADDRESS),
'website' => $this->getProperty($account, IAccountManager::PROPERTY_WEBSITE),
'twitter' => $this->getProperty($account, IAccountManager::PROPERTY_TWITTER),
+ 'bluesky' => $this->getProperty($account, IAccountManager::PROPERTY_BLUESKY),
'fediverse' => $this->getProperty($account, IAccountManager::PROPERTY_FEDIVERSE),
'languageMap' => $this->getLanguageMap($user),
'localeMap' => $this->getLocaleMap($user),
@@ -141,11 +109,14 @@ class PersonalInfo implements ISettings {
'headline' => $this->getProperty($account, IAccountManager::PROPERTY_HEADLINE),
'biography' => $this->getProperty($account, IAccountManager::PROPERTY_BIOGRAPHY),
'birthdate' => $this->getProperty($account, IAccountManager::PROPERTY_BIRTHDATE),
+ 'firstDayOfWeek' => $this->config->getUserValue($uid, 'core', AUserDataOCSController::USER_FIELD_FIRST_DAY_OF_WEEK),
+ 'pronouns' => $this->getProperty($account, IAccountManager::PROPERTY_PRONOUNS),
];
$accountParameters = [
'avatarChangeSupported' => $user->canChangeAvatar(),
'displayNameChangeSupported' => $user->canChangeDisplayName(),
+ 'emailChangeSupported' => $user->canChangeEmail(),
'federationEnabled' => $federationEnabled,
'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
];
@@ -195,8 +166,8 @@ class PersonalInfo implements ISettings {
/**
* @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
+ * the admin section. The forms are arranged in ascending order of the
+ * priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
* @since 9.1
@@ -298,8 +269,8 @@ class PersonalInfo implements ISettings {
}
$uid = $user->getUID();
- $userLocaleString = $this->config->getUserValue($uid, 'core', 'locale', $this->l10nFactory->findLocale());
$userLang = $this->config->getUserValue($uid, 'core', 'lang', $this->l10nFactory->findLanguage());
+ $userLocaleString = $this->config->getUserValue($uid, 'core', 'locale', $this->l10nFactory->findLocale($userLang));
$localeCodes = $this->l10nFactory->findAvailableLocales();
$userLocale = array_filter($localeCodes, fn ($value) => $userLocaleString === $value['code']);
diff --git a/apps/settings/lib/Settings/Personal/Security/Authtokens.php b/apps/settings/lib/Settings/Personal/Security/Authtokens.php
index 90f6e23cbb7..e0509b22a9c 100644
--- a/apps/settings/lib/Settings/Personal/Security/Authtokens.php
+++ b/apps/settings/lib/Settings/Personal/Security/Authtokens.php
@@ -22,31 +22,13 @@ use function array_map;
class Authtokens implements ISettings {
- /** @var IAuthTokenProvider */
- private $tokenProvider;
-
- /** @var ISession */
- private $session;
-
- /** @var IInitialState */
- private $initialState;
-
- /** @var string|null */
- private $uid;
-
- /** @var IUserSession */
- private $userSession;
-
- public function __construct(IAuthTokenProvider $tokenProvider,
- ISession $session,
- IUserSession $userSession,
- IInitialState $initialState,
- ?string $UserId) {
- $this->tokenProvider = $tokenProvider;
- $this->session = $session;
- $this->initialState = $initialState;
- $this->uid = $UserId;
- $this->userSession = $userSession;
+ public function __construct(
+ private IAuthTokenProvider $tokenProvider,
+ private ISession $session,
+ private IUserSession $userSession,
+ private IInitialState $initialState,
+ private ?string $userId,
+ ) {
}
public function getForm(): TemplateResponse {
@@ -72,7 +54,7 @@ class Authtokens implements ISettings {
}
private function getAppTokens(): array {
- $tokens = $this->tokenProvider->getTokenByUser($this->uid);
+ $tokens = $this->tokenProvider->getTokenByUser($this->userId);
try {
$sessionId = $this->session->getId();
diff --git a/apps/settings/lib/Settings/Personal/Security/Password.php b/apps/settings/lib/Settings/Personal/Security/Password.php
index 753dacf3bdb..8184dae9560 100644
--- a/apps/settings/lib/Settings/Personal/Security/Password.php
+++ b/apps/settings/lib/Settings/Personal/Security/Password.php
@@ -14,20 +14,14 @@ use OCP\Settings\ISettings;
class Password implements ISettings {
- /** @var IUserManager */
- private $userManager;
-
- /** @var string|null */
- private $uid;
-
- public function __construct(IUserManager $userManager,
- ?string $UserId) {
- $this->userManager = $userManager;
- $this->uid = $UserId;
+ public function __construct(
+ private IUserManager $userManager,
+ private ?string $userId,
+ ) {
}
public function getForm(): TemplateResponse {
- $user = $this->userManager->get($this->uid);
+ $user = $this->userManager->get($this->userId);
$passwordChangeSupported = false;
if ($user !== null) {
$passwordChangeSupported = $user->canChangePassword();
diff --git a/apps/settings/lib/Settings/Personal/Security/TwoFactor.php b/apps/settings/lib/Settings/Personal/Security/TwoFactor.php
index 63b647f7c44..0c419cb6fa7 100644
--- a/apps/settings/lib/Settings/Personal/Security/TwoFactor.php
+++ b/apps/settings/lib/Settings/Personal/Security/TwoFactor.php
@@ -30,25 +30,15 @@ class TwoFactor implements ISettings {
/** @var MandatoryTwoFactor */
private $mandatoryTwoFactor;
- /** @var IUserSession */
- private $userSession;
-
- /** @var string|null */
- private $uid;
-
- /** @var IConfig */
- private $config;
-
- public function __construct(ProviderLoader $providerLoader,
+ public function __construct(
+ ProviderLoader $providerLoader,
MandatoryTwoFactor $mandatoryTwoFactor,
- IUserSession $userSession,
- IConfig $config,
- ?string $UserId) {
+ private IUserSession $userSession,
+ private IConfig $config,
+ private ?string $userId,
+ ) {
$this->providerLoader = $providerLoader;
$this->mandatoryTwoFactor = $mandatoryTwoFactor;
- $this->userSession = $userSession;
- $this->uid = $UserId;
- $this->config = $config;
}
public function getForm(): TemplateResponse {
diff --git a/apps/settings/lib/Settings/Personal/Security/WebAuthn.php b/apps/settings/lib/Settings/Personal/Security/WebAuthn.php
index e65004e7dd3..a6ba4e9522a 100644
--- a/apps/settings/lib/Settings/Personal/Security/WebAuthn.php
+++ b/apps/settings/lib/Settings/Personal/Security/WebAuthn.php
@@ -20,22 +20,16 @@ class WebAuthn implements ISettings {
/** @var PublicKeyCredentialMapper */
private $mapper;
- /** @var string */
- private $uid;
-
- /** @var IInitialStateService */
- private $initialStateService;
-
/** @var Manager */
private $manager;
- public function __construct(PublicKeyCredentialMapper $mapper,
- string $UserId,
- IInitialStateService $initialStateService,
- Manager $manager) {
+ public function __construct(
+ PublicKeyCredentialMapper $mapper,
+ private string $userId,
+ private IInitialStateService $initialStateService,
+ Manager $manager,
+ ) {
$this->mapper = $mapper;
- $this->uid = $UserId;
- $this->initialStateService = $initialStateService;
$this->manager = $manager;
}
@@ -43,11 +37,10 @@ class WebAuthn implements ISettings {
$this->initialStateService->provideInitialState(
Application::APP_ID,
'webauthn-devices',
- $this->mapper->findAllForUid($this->uid)
+ $this->mapper->findAllForUid($this->userId)
);
- return new TemplateResponse('settings', 'settings/personal/security/webauthn', [
- ]);
+ return new TemplateResponse('settings', 'settings/personal/security/webauthn');
}
public function getSection(): ?string {
diff --git a/apps/settings/lib/Settings/Personal/ServerDevNotice.php b/apps/settings/lib/Settings/Personal/ServerDevNotice.php
index 702daf08494..c9993484abd 100644
--- a/apps/settings/lib/Settings/Personal/ServerDevNotice.php
+++ b/apps/settings/lib/Settings/Personal/ServerDevNotice.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@@ -18,36 +19,14 @@ use OCP\Util;
class ServerDevNotice implements ISettings {
- /** @var IRegistry */
- private $registry;
-
- /** @var IEventDispatcher */
- private $eventDispatcher;
-
- /** @var IRootFolder */
- private $rootFolder;
-
- /** @var IUserSession */
- private $userSession;
-
- /** @var IInitialState */
- private $initialState;
-
- /** @var IURLGenerator */
- private $urlGenerator;
-
- public function __construct(IRegistry $registry,
- IEventDispatcher $eventDispatcher,
- IRootFolder $rootFolder,
- IUserSession $userSession,
- IInitialState $initialState,
- IURLGenerator $urlGenerator) {
- $this->registry = $registry;
- $this->eventDispatcher = $eventDispatcher;
- $this->rootFolder = $rootFolder;
- $this->userSession = $userSession;
- $this->initialState = $initialState;
- $this->urlGenerator = $urlGenerator;
+ public function __construct(
+ private IRegistry $registry,
+ private IEventDispatcher $eventDispatcher,
+ private IRootFolder $rootFolder,
+ private IUserSession $userSession,
+ private IInitialState $initialState,
+ private IURLGenerator $urlGenerator,
+ ) {
}
/**
@@ -89,8 +68,8 @@ class ServerDevNotice implements ISettings {
/**
* @return int whether the form should be rather on the top or bottom of
- * the admin section. The forms are arranged in ascending order of the
- * priority values. It is required to return a value between 0 and 100.
+ * the admin section. The forms are arranged in ascending order of the
+ * priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
*/