summaryrefslogtreecommitdiffstats
path: root/lib/private/Settings
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-06-16 15:00:15 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-06-23 12:37:42 +0200
commitd7a2290ce15c70b219ecae8f0076e38a2471070d (patch)
tree01cb2b272264882565d36456dba7fa43e467209a /lib/private/Settings
parent0dcce5a83568ecf40f59e7efcc1308ace89d15d5 (diff)
downloadnextcloud-server-d7a2290ce15c70b219ecae8f0076e38a2471070d.tar.gz
nextcloud-server-d7a2290ce15c70b219ecae8f0076e38a2471070d.zip
take over changes from #5084
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/private/Settings')
-rw-r--r--lib/private/Settings/Manager.php17
-rw-r--r--lib/private/Settings/Personal/PersonalInfo.php49
2 files changed, 57 insertions, 9 deletions
diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php
index 7da8bfe65df..d04f4abdcd8 100644
--- a/lib/private/Settings/Manager.php
+++ b/lib/private/Settings/Manager.php
@@ -24,6 +24,7 @@
namespace OC\Settings;
use OC\Accounts\AccountManager;
+use OCP\App\IAppManager;
use OCP\AppFramework\QueryException;
use OCP\Encryption\IManager as EncryptionManager;
use OCP\IConfig;
@@ -69,6 +70,8 @@ class Manager implements IManager {
private $l10nFactory;
/** @var \OC_Defaults */
private $defaults;
+ /** @var IAppManager */
+ private $appManager;
/**
* @param ILogger $log
@@ -100,7 +103,8 @@ class Manager implements IManager {
AccountManager $accountManager,
IGroupManager $groupManager,
IFactory $l10nFactory,
- \OC_Defaults $defaults
+ \OC_Defaults $defaults,
+ IAppManager $appManager
) {
$this->log = $log;
$this->dbc = $dbc;
@@ -116,6 +120,7 @@ class Manager implements IManager {
$this->groupManager = $groupManager;
$this->l10nFactory = $l10nFactory;
$this->defaults = $defaults;
+ $this->appManager = $appManager;
}
/**
@@ -402,7 +407,15 @@ class Manager implements IManager {
try {
if ($section === 'personal-info') {
/** @var ISettings $form */
- $form = new Personal\PersonalInfo($this->config, $this->userManager, $this->groupManager, $this->accountManager, $this->l10nFactory, $this->l);
+ $form = new Personal\PersonalInfo(
+ $this->config,
+ $this->userManager,
+ $this->groupManager,
+ $this->accountManager,
+ $this->appManager,
+ $this->l10nFactory,
+ $this->l
+ );
$forms[$form->getPriority()] = [$form];
}
if($section === 'sessions') {
diff --git a/lib/private/Settings/Personal/PersonalInfo.php b/lib/private/Settings/Personal/PersonalInfo.php
index ea7cecaa794..eb0ff253db1 100644
--- a/lib/private/Settings/Personal/PersonalInfo.php
+++ b/lib/private/Settings/Personal/PersonalInfo.php
@@ -25,6 +25,8 @@
namespace OC\Settings\Personal;
use OC\Accounts\AccountManager;
+use OCA\FederatedFileSharing\AppInfo\Application;
+use OCP\App\IAppManager;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Files\FileInfo;
use OCP\IConfig;
@@ -45,6 +47,8 @@ class PersonalInfo implements ISettings {
private $accountManager;
/** @var IGroupManager */
private $groupManager;
+ /** @var IAppManager */
+ private $appManager;
/** @var IFactory */
private $l10nFactory;
@@ -69,6 +73,7 @@ class PersonalInfo implements ISettings {
IUserManager $userManager,
IGroupManager $groupManager,
AccountManager $accountManager,
+ IAppManager $appManager,
IFactory $l10nFactory,
IL10N $l
) {
@@ -76,6 +81,7 @@ class PersonalInfo implements ISettings {
$this->userManager = $userManager;
$this->accountManager = $accountManager;
$this->groupManager = $groupManager;
+ $this->appManager = $appManager;
$this->l10nFactory = $l10nFactory;
$this->l = $l;
}
@@ -85,8 +91,13 @@ class PersonalInfo implements ISettings {
* @since 9.1
*/
public function getForm() {
- $lookupServerUploadEnabled = $this->config->getAppValue('files_sharing', 'lookupServerUploadEnabled', 'yes');
- $lookupServerUploadEnabled = $lookupServerUploadEnabled === 'yes';
+ $federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing');
+ $lookupServerUploadEnabled = false;
+ if($federatedFileSharingEnabled) {
+ $federatedFileSharing = new Application();
+ $shareProvider = $federatedFileSharing->getFederatedShareProvider();
+ $lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled();
+ }
$uid = \OC_User::getUser();
$user = $this->userManager->get($uid);
@@ -100,6 +111,7 @@ class PersonalInfo implements ISettings {
}
list($activeLanguage, $commonLanguages, $languages) = $this->getLanguages($user);
+ $messageParameters = $this->getMessageParameters($userData);
$parameters = [
'total_space' => $totalSpace,
@@ -108,17 +120,17 @@ class PersonalInfo implements ISettings {
'quota' => $storageInfo['quota'],
'avatarChangeSupported' => \OC_User::canUserChangeAvatar($uid),
'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
- 'avatar_scope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'],
+ 'avatarScope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'],
'displayNameChangeSupported' => \OC_User::canUserChangeDisplayName($uid),
'displayName' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['value'],
+ 'displayNameScope' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['scope'],
'email' => $userData[AccountManager::PROPERTY_EMAIL]['value'],
'emailScope' => $userData[AccountManager::PROPERTY_EMAIL]['scope'],
- 'emailMesage' => '',
'emailVerification' => $userData[AccountManager::PROPERTY_EMAIL]['verified'],
'phone' => $userData[AccountManager::PROPERTY_PHONE]['value'],
'phoneScope' => $userData[AccountManager::PROPERTY_PHONE]['scope'],
- 'address', $userData[AccountManager::PROPERTY_ADDRESS]['value'],
- 'addressScope', $userData[AccountManager::PROPERTY_ADDRESS]['scope'],
+ 'address' => $userData[AccountManager::PROPERTY_ADDRESS]['value'],
+ 'addressScope' => $userData[AccountManager::PROPERTY_ADDRESS]['scope'],
'website' => $userData[AccountManager::PROPERTY_WEBSITE]['value'],
'websiteScope' => $userData[AccountManager::PROPERTY_WEBSITE]['scope'],
'websiteVerification' => $userData[AccountManager::PROPERTY_WEBSITE]['verified'],
@@ -130,7 +142,7 @@ class PersonalInfo implements ISettings {
'activelanguage' => $activeLanguage,
'commonlanguages' => $commonLanguages,
'languages' => $languages,
- ];
+ ] + $messageParameters;
return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, '');
@@ -237,4 +249,27 @@ class PersonalInfo implements ISettings {
return [$userLang, $commonLanguages, $languages];
}
+ /**
+ * @param array $userData
+ * @return array
+ */
+ private function getMessageParameters(array $userData) {
+ $needVerifyMessage = [AccountManager::PROPERTY_EMAIL, AccountManager::PROPERTY_WEBSITE, AccountManager::PROPERTY_TWITTER];
+ $messageParameters = [];
+ foreach ($needVerifyMessage as $property) {
+ switch ($userData[$property]['verified']) {
+ case AccountManager::VERIFIED:
+ $message = $this->l->t('Verifying');
+ break;
+ case AccountManager::VERIFICATION_IN_PROGRESS:
+ $message = $this->l->t('Verifying …');
+ break;
+ default:
+ $message = $this->l->t('Verify');
+ }
+ $messageParameters[$property . 'Message'] = $message;
+ }
+ return $messageParameters;
+ }
+
}