From 8f33d9d1c07c164b18be9d36e9e9f79b5bdfa8be Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 11 Nov 2016 14:36:17 +0100 Subject: [PATCH] update system address book if the user change the personal settings Signed-off-by: Bjoern Schiessle --- apps/dav/lib/AppInfo/Application.php | 10 ++ apps/dav/lib/CardDAV/Converter.php | 144 +++++++++--------------- apps/dav/lib/CardDAV/SyncService.php | 27 ++++- apps/dav/lib/HookManager.php | 9 +- lib/private/Accounts/AccountManager.php | 112 +++++++++++++++--- lib/private/Updater.php | 2 +- settings/Controller/UsersController.php | 39 ++++--- settings/js/federationsettingsview.js | 3 +- settings/personal.php | 35 +++--- settings/templates/personal.php | 24 +++- 10 files changed, 261 insertions(+), 144 deletions(-) diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index 844e0780ffb..80d2946ab07 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -101,6 +101,12 @@ class Application extends App { } }); + $dispatcher->addListener('OC\AccountManager::userUpdated', function(GenericEvent $event) { + $user = $event->getSubject(); + $syncService = $this->getContainer()->query(SyncService::class); + $syncService->updateUser($user); + }); + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', function(GenericEvent $event) { /** @var Backend $backend */ $backend = $this->getContainer()->query(Backend::class); @@ -136,6 +142,10 @@ class Application extends App { ); }); + $dispatcher->addListener('OC\AccountManager::userUpdated', function(GenericEvent $event) { + error_log("hello"); + }); + $listener = function(GenericEvent $event, $eventName) { /** @var Backend $backend */ $backend = $this->getContainer()->query(Backend::class); diff --git a/apps/dav/lib/CardDAV/Converter.php b/apps/dav/lib/CardDAV/Converter.php index d1fb754017e..065c5494ec3 100644 --- a/apps/dav/lib/CardDAV/Converter.php +++ b/apps/dav/lib/CardDAV/Converter.php @@ -22,6 +22,7 @@ namespace OCA\DAV\CardDAV; +use OC\Accounts\AccountManager; use OCP\IImage; use OCP\IUser; use Sabre\VObject\Component\VCard; @@ -29,109 +30,76 @@ use Sabre\VObject\Property\Text; class Converter { + /** @var AccountManager */ + private $accountManager; + /** - * @param IUser $user - * @return VCard + * Converter constructor. + * + * @param AccountManager $accountManager */ - public function createCardFromUser(IUser $user) { - - $uid = $user->getUID(); - $displayName = $user->getDisplayName(); - $displayName = empty($displayName ) ? $uid : $displayName; - $emailAddress = $user->getEMailAddress(); - $cloudId = $user->getCloudId(); - $image = $this->getAvatarImage($user); - - $vCard = new VCard(); - $vCard->VERSION = '3.0'; - $vCard->UID = $uid; - if (!empty($displayName)) { - $vCard->FN = $displayName; - $vCard->N = $this->splitFullName($displayName); - } - if (!empty($emailAddress)) { - $vCard->add(new Text($vCard, 'EMAIL', $emailAddress, ['TYPE' => 'OTHER'])); - } - if (!empty($cloudId)) { - $vCard->CLOUD = $cloudId; - } - if ($image) { - $vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]); - } - $vCard->validate(); - - return $vCard; + public function __construct(AccountManager $accountManager) { + $this->accountManager = $accountManager; } /** - * @param VCard $vCard * @param IUser $user - * @return bool + * @return VCard|null */ - public function updateCard(VCard $vCard, IUser $user) { + public function createCardFromUser(IUser $user) { + + $userData = $this->accountManager->getUser($user); + $uid = $user->getUID(); - $displayName = $user->getDisplayName(); - $displayName = empty($displayName ) ? $uid : $displayName; - $emailAddress = $user->getEMailAddress(); $cloudId = $user->getCloudId(); $image = $this->getAvatarImage($user); - $updated = false; - if($this->propertyNeedsUpdate($vCard, 'FN', $displayName)) { - $vCard->FN = new Text($vCard, 'FN', $displayName); - unset($vCard->N); - $vCard->add(new Text($vCard, 'N', $this->splitFullName($displayName))); - $updated = true; - } - if($this->propertyNeedsUpdate($vCard, 'EMAIL', $emailAddress)) { - $vCard->EMAIL = new Text($vCard, 'EMAIL', $emailAddress); - $updated = true; - } - if($this->propertyNeedsUpdate($vCard, 'CLOUD', $cloudId)) { - $vCard->CLOUD = new Text($vCard, 'CLOUD', $cloudId); - $updated = true; - } - - if($this->propertyNeedsUpdate($vCard, 'PHOTO', $image)) { - unset($vCard->PHOTO); - $vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]); - $updated = true; - } - - if (empty($emailAddress) && !is_null($vCard->EMAIL)) { - unset($vCard->EMAIL); - $updated = true; - } - if (empty($cloudId) && !is_null($vCard->CLOUD)) { - unset($vCard->CLOUD); - $updated = true; - } - if (empty($image) && !is_null($vCard->PHOTO)) { - unset($vCard->PHOTO); - $updated = true; + $vCard = new VCard(); + $vCard->add(new Text($vCard, 'UID', $uid)); + + $publish = false; + + foreach ($userData as $property => $value) { + if ($value['scope'] === AccountManager::VISIBILITY_CONTACTS_ONLY || + $value['scope'] === AccountManager::VISIBILITY_PUBLIC + ) { + $publish = true; + switch ($property) { + case AccountManager::PROPERTY_DISPLAYNAME: + $vCard->add(new Text($vCard, 'FN', $value['value'])); + $vCard->add(new Text($vCard, 'N', $this->splitFullName($value['value']))); + break; + case AccountManager::PROPERTY_AVATAR: + if ($image !== null) { + $vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]); + } + break; + case AccountManager::PROPERTY_EMAIL: + $vCard->add(new Text($vCard, 'EMAIL', $value['value'], ['TYPE' => 'OTHER'])); + break; + case AccountManager::PROPERTY_WEBSITE: + $vCard->add(new Text($vCard, 'URL', $value['value'])); + break; + case AccountManager::PROPERTY_PHONE: + $vCard->add(new Text($vCard, 'TEL', $value['value'], ['TYPE' => 'OTHER'])); + break; + case AccountManager::PROPERTY_ADDRESS: + $vCard->add(new Text($vCard, 'ADR', $value['value'], ['TYPE' => 'OTHER'])); + break; + case AccountManager::PROPERTY_TWITTER: + $vCard->add(new Text($vCard, 'X-SOCIALPROFILE', $value['value'], ['TYPE' => 'TWITTER'])); + break; + } + } } - return $updated; - } - - /** - * @param VCard $vCard - * @param string $name - * @param string|IImage $newValue - * @return bool - */ - private function propertyNeedsUpdate(VCard $vCard, $name, $newValue) { - if (is_null($newValue)) { - return false; + if ($publish && !empty($cloudId)) { + $vCard->add(new Text($vCard, 'CLOUD', $cloudId)); + $vCard->validate(); + return $vCard; } - $value = $vCard->__get($name); - if (!is_null($value)) { - $value = $value->getValue(); - $newValue = $newValue instanceof IImage ? $newValue->data() : $newValue; - return $value !== $newValue; - } - return true; + return null; } /** diff --git a/apps/dav/lib/CardDAV/SyncService.php b/apps/dav/lib/CardDAV/SyncService.php index 1ad37da6bfe..1293d8ae8a0 100644 --- a/apps/dav/lib/CardDAV/SyncService.php +++ b/apps/dav/lib/CardDAV/SyncService.php @@ -24,6 +24,7 @@ namespace OCA\DAV\CardDAV; +use OC\Accounts\AccountManager; use OCP\AppFramework\Http; use OCP\ILogger; use OCP\IUser; @@ -48,10 +49,22 @@ class SyncService { /** @var array */ private $localSystemAddressBook; - public function __construct(CardDavBackend $backend, IUserManager $userManager, ILogger $logger) { + /** @var AccountManager */ + private $accountManager; + + /** + * SyncService constructor. + * + * @param CardDavBackend $backend + * @param IUserManager $userManager + * @param ILogger $logger + * @param AccountManager $accountManager + */ + public function __construct(CardDavBackend $backend, IUserManager $userManager, ILogger $logger, AccountManager $accountManager) { $this->backend = $backend; $this->userManager = $userManager; $this->logger = $logger; + $this->accountManager = $accountManager; } /** @@ -215,7 +228,7 @@ class SyncService { public function updateUser($user) { $systemAddressBook = $this->getLocalSystemAddressBook(); $addressBookId = $systemAddressBook['id']; - $converter = new Converter(); + $converter = new Converter($this->accountManager); $name = $user->getBackendClassName(); $userId = $user->getUID(); @@ -223,10 +236,14 @@ class SyncService { $card = $this->backend->getCard($addressBookId, $cardId); if ($card === false) { $vCard = $converter->createCardFromUser($user); - $this->backend->createCard($addressBookId, $cardId, $vCard->serialize()); + if ($vCard !== null) { + $this->backend->createCard($addressBookId, $cardId, $vCard->serialize()); + } } else { - $vCard = Reader::read($card['carddata']); - if ($converter->updateCard($vCard, $user)) { + $vCard = $converter->createCardFromUser($user); + if (is_null($vCard)) { + $this->backend->deleteCard($addressBookId, $cardId); + } else { $this->backend->updateCard($addressBookId, $cardId, $vCard->serialize()); } } diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php index 247d4b291af..26f3895a459 100644 --- a/apps/dav/lib/HookManager.php +++ b/apps/dav/lib/HookManager.php @@ -27,6 +27,8 @@ use OCA\DAV\CardDAV\SyncService; use OCP\IUser; use OCP\IUserManager; use OCP\Util; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\GenericEvent; class HookManager { @@ -51,14 +53,19 @@ class HookManager { /** @var array */ private $addressBooksToDelete; + /** @var EventDispatcher */ + private $eventDispatcher; + public function __construct(IUserManager $userManager, SyncService $syncService, CalDavBackend $calDav, - CardDavBackend $cardDav) { + CardDavBackend $cardDav, + EventDispatcher $eventDispatcher) { $this->userManager = $userManager; $this->syncService = $syncService; $this->calDav = $calDav; $this->cardDav = $cardDav; + $this->eventDispatcher = $eventDispatcher; } public function setup() { diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 3decac0153a..9485f8bc19a 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -1,8 +1,9 @@ + * @author Björn Schießle * * @copyright Copyright (c) 2016, ownCloud, Inc. + * @copyright Copyright (c) 2016, Björn Schießle * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -24,6 +25,9 @@ namespace OC\Accounts; use OCP\IDBConnection; +use OCP\IUser; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\EventDispatcher\GenericEvent; /** * Class AccountManager @@ -35,37 +39,69 @@ use OCP\IDBConnection; */ class AccountManager { + /** nobody can see my account details */ + const VISIBILITY_PRIVATE = 'private'; + /** only contacts, especially trusted servers can see my contact details */ + const VISIBILITY_CONTACTS_ONLY = 'contacts'; + /** every body ca see my contact detail, will be published to the lookup server */ + const VISIBILITY_PUBLIC = 'public'; + + const PROPERTY_AVATAR = 'avatar'; + const PROPERTY_DISPLAYNAME = 'displayname'; + const PROPERTY_PHONE = 'phone'; + const PROPERTY_EMAIL = 'email'; + const PROPERTY_WEBSITE = 'website'; + const PROPERTY_ADDRESS = 'address'; + const PROPERTY_TWITTER = 'twitter'; + /** @var IDBConnection database connection */ private $connection; /** @var string table name */ private $table = 'accounts'; + /** @var EventDispatcherInterface */ + private $eventDispatcher; + /** * AccountManager constructor. * * @param IDBConnection $connection + * @param EventDispatcherInterface $eventDispatcher */ - public function __construct(IDBConnection $connection) { + public function __construct(IDBConnection $connection, EventDispatcherInterface $eventDispatcher) { $this->connection = $connection; + $this->eventDispatcher = $eventDispatcher; } - public function updateUser($uid, $data) { - $userData = $this->getUser($uid); + /** + * update user record + * + * @param IUser $user + * @param $data + */ + public function updateUser(IUser $user, $data) { + $userData = $this->getUser($user); if (empty($userData)) { - $this->insertNewUser($uid, $data); + $this->insertNewUser($user, $data); } else { - $this->updateExistingUser($uid, $data); + $this->updateExistingUser($user, $data); } + + $this->eventDispatcher->dispatch( + 'OC\AccountManager::userUpdated', + new GenericEvent($user) + ); } /** * get stored data from a given user * - * @param $uid + * @param IUser $user * @return array */ - public function getUser($uid) { + public function getUser(IUser $user) { + $uid = $user->getUID(); $query = $this->connection->getQueryBuilder(); $query->select('data')->from($this->table) ->where($query->expr()->eq('uid', $query->createParameter('uid'))) @@ -74,7 +110,9 @@ class AccountManager { $result = $query->execute()->fetchAll(); if (empty($result)) { - return []; + $userData = $this->buildDefaultUserRecord($user); + $this->insertNewUser($user, $userData); + return $userData; } return json_decode($result[0]['data'], true); @@ -83,10 +121,11 @@ class AccountManager { /** * add new user to accounts table * - * @param string $uid + * @param IUser $user * @param array $data */ - protected function insertNewUser($uid, $data) { + protected function insertNewUser(IUser $user, $data) { + $uid = $user->getUID(); $jsonEncodedData = json_encode($data); $query = $this->connection->getQueryBuilder(); $query->insert($this->table) @@ -102,10 +141,11 @@ class AccountManager { /** * update existing user in accounts table * - * @param string $uid + * @param IUser $user * @param array $data */ - protected function updateExistingUser($uid, $data) { + protected function updateExistingUser(IUser $user, $data) { + $uid = $user->getUID(); $jsonEncodedData = json_encode($data); $query = $this->connection->getQueryBuilder(); $query->update($this->table) @@ -113,4 +153,50 @@ class AccountManager { ->where($query->expr()->eq('uid', $query->createNamedParameter($uid))) ->execute(); } + + /** + * build default user record in case not data set exists yet + * + * @param IUser $user + * @return array + */ + protected function buildDefaultUserRecord(IUser $user) { + return [ + self::PROPERTY_DISPLAYNAME => + [ + 'value' => $user->getDisplayName(), + 'scope' => self::VISIBILITY_CONTACTS_ONLY, + ], + self::PROPERTY_ADDRESS => + [ + 'value' => '', + 'scope' => self::VISIBILITY_PRIVATE, + ], + self::PROPERTY_WEBSITE => + [ + 'value' => '', + 'scope' => self::VISIBILITY_PRIVATE, + ], + self::PROPERTY_EMAIL => + [ + 'value' => $user->getEMailAddress(), + 'scope' => self::VISIBILITY_CONTACTS_ONLY, + ], + self::PROPERTY_AVATAR => + [ + 'scope' => self::VISIBILITY_CONTACTS_ONLY + ], + self::PROPERTY_PHONE => + [ + 'value' => '', + 'scope' => self::VISIBILITY_PRIVATE, + ], + self::PROPERTY_TWITTER => + [ + 'value' => '', + 'scope' => self::VISIBILITY_PRIVATE, + ], + ]; + } + } diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 2fed67988b8..c3d8ef9fea3 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -53,7 +53,7 @@ class Updater extends BasicEmitter { /** @var ILogger $log */ private $log; - + /** @var IConfig */ private $config; diff --git a/settings/Controller/UsersController.php b/settings/Controller/UsersController.php index 6bbf8786520..08d97a0f581 100644 --- a/settings/Controller/UsersController.php +++ b/settings/Controller/UsersController.php @@ -519,6 +519,8 @@ class UsersController extends Controller { * @param string $websiteScope * @param string $address * @param string $addressScope + * @param string $twitter + * @param string $twitterScope * @return DataResponse */ public function setUserSettings($avatarScope, @@ -526,7 +528,8 @@ class UsersController extends Controller { $phone, $phoneScope, $email, $emailScope, $website, $websiteScope, - $address, $addressScope + $address, $addressScope, + $twitter, $twitterScope ) { @@ -542,26 +545,27 @@ class UsersController extends Controller { ); } - $userId = $this->userSession->getUser()->getUID(); + $user = $this->userSession->getUser(); $data = [ - 'avatar' => ['scope' => $avatarScope], - 'displayName' => ['value' => $displayname, 'scope' => $displaynameScope], - 'email' => [['value' => $email, 'scope' => $emailScope]], - 'website' => [['value' => $website, 'scope' => $websiteScope]], - 'address' => [['value' => $address, 'scope' => $addressScope]], - 'phone' => [['value' => $phone, 'scope' => $phoneScope]] + AccountManager::PROPERTY_AVATAR => ['scope' => $avatarScope], + AccountManager::PROPERTY_DISPLAYNAME => ['value' => $displayname, 'scope' => $displaynameScope], + AccountManager::PROPERTY_EMAIL=> ['value' => $email, 'scope' => $emailScope], + AccountManager::PROPERTY_WEBSITE => ['value' => $website, 'scope' => $websiteScope], + AccountManager::PROPERTY_ADDRESS => ['value' => $address, 'scope' => $addressScope], + AccountManager::PROPERTY_PHONE => ['value' => $phone, 'scope' => $phoneScope], + AccountManager::PROPERTY_TWITTER => ['value' => $twitter, 'scope' => $twitterScope] ]; - $this->accountManager->updateUser($userId, $data); + $this->accountManager->updateUser($user, $data); try { - $this->saveUserSettings($userId, $data); + $this->saveUserSettings($user, $data); return new DataResponse( array( 'status' => 'success', 'data' => array( - 'userId' => $userId, + 'userId' => $user->getUID(), 'avatarScope' => $avatarScope, 'displayname' => $displayname, 'displaynameScope' => $displaynameScope, @@ -591,12 +595,11 @@ class UsersController extends Controller { /** * update account manager with new user data * - * @param string $userId + * @param IUser $user * @param array $data * @throws ForbiddenException */ - private function saveUserSettings($userId, $data) { - $user = $this->userManager->get($userId); + private function saveUserSettings(IUser $user, $data) { // keep the user back-end up-to-date with the latest display name and email // address @@ -614,7 +617,7 @@ class UsersController extends Controller { } } - $this->accountManager->updateUser($userId, $data); + $this->accountManager->updateUser($user, $data); } /** @@ -688,12 +691,12 @@ class UsersController extends Controller { ]); } - $userData = $this->accountManager->getUser($user->getUID()); - $userData['displayName']['value'] = $displayName; + $userData = $this->accountManager->getUser($user); + $userData[AccountManager::PROPERTY_DISPLAYNAME]['value'] = $displayName; try { - $this->saveUserSettings($username, $userData); + $this->saveUserSettings($user, $userData); return new DataResponse([ 'status' => 'success', 'data' => [ diff --git a/settings/js/federationsettingsview.js b/settings/js/federationsettingsview.js index 73b9f857558..6d9c407b2da 100644 --- a/settings/js/federationsettingsview.js +++ b/settings/js/federationsettingsview.js @@ -30,6 +30,7 @@ 'phone', 'email', 'website', + 'twitter', 'address', 'avatar' ]; @@ -159,4 +160,4 @@ OC.Settings = OC.Settings || {}; OC.Settings.FederationSettingsView = FederationSettingsView; -})(_, $, OC); \ No newline at end of file +})(_, $, OC); diff --git a/settings/personal.php b/settings/personal.php index 9475b674b75..24955c94071 100644 --- a/settings/personal.php +++ b/settings/personal.php @@ -40,7 +40,7 @@ OC_Util::checkLoggedIn(); $defaults = \OC::$server->getThemingDefaults(); $certificateManager = \OC::$server->getCertificateManager(); -$accountManager = new \OC\Accounts\AccountManager(\OC::$server->getDatabaseConnection()); +$accountManager = new \OC\Accounts\AccountManager(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher()); $config = \OC::$server->getConfig(); $urlGenerator = \OC::$server->getURLGenerator(); @@ -70,7 +70,6 @@ OC::$server->getNavigationManager()->setActiveEntry('personal'); $storageInfo=OC_Helper::getStorageInfo('/'); $user = OC::$server->getUserManager()->get(OC_User::getUser()); -$email = $user->getEMailAddress(); $userLang=$config->getUserValue( OC_User::getUser(), 'core', 'lang', \OC::$server->getL10NFactory()->findLanguage() ); $languageCodes = \OC::$server->getL10NFactory()->findAvailableLanguages(); @@ -156,29 +155,33 @@ if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) { } else { $totalSpace = OC_Helper::humanFileSize($storageInfo['total']); } -$userData = $accountManager->getUser($user->getUID()); + +$uid = $user->getUID(); +$userData = $accountManager->getUser($user); $tmpl->assign('total_space', $totalSpace); $tmpl->assign('usage_relative', $storageInfo['relative']); $tmpl->assign('clients', $clients); -$tmpl->assign('email', $email); +$tmpl->assign('email', $userData[\OC\Accounts\AccountManager::PROPERTY_EMAIL]['value']); $tmpl->assign('languages', $languages); $tmpl->assign('commonlanguages', $commonLanguages); $tmpl->assign('activelanguage', $userLang); $tmpl->assign('passwordChangeSupported', OC_User::canUserChangePassword(OC_User::getUser())); $tmpl->assign('displayNameChangeSupported', OC_User::canUserChangeDisplayName(OC_User::getUser())); -$tmpl->assign('displayName', OC_User::getDisplayName()); - -$tmpl->assign('phone', isset($userData['phone'][0]['value']) ? $userData['phone'][0]['value'] : null); -$tmpl->assign('website', isset($userData['website'][0]['value']) ? $userData['website'][0]['value'] : null); -$tmpl->assign('address', isset($userData['address'][0]['value']) ? $userData['address'][0]['value'] : null); - -$tmpl->assign('avatarScope', isset($userData['avatar']['scope']) ? $userData['avatar']['scope'] : 'contacts'); -$tmpl->assign('displayNameScope', isset($userData['displayName']['scope']) ? $userData['displayName']['scope'] : 'contacts'); -$tmpl->assign('phoneScope', isset($userData['phone'][0]['scope']) ? $userData['phone'][0]['scope'] : 'private'); -$tmpl->assign('emailScope', isset($userData['email'][0]['scope']) ? $userData['email'][0]['scope'] : 'private'); -$tmpl->assign('websiteScope', isset($userData['website'][0]['scope']) ? $userData['website'][0]['scope'] : 'private'); -$tmpl->assign('addressScope', isset($userData['address'][0]['scope']) ? $userData['address'][0]['scope'] : 'private'); +$tmpl->assign('displayName', $userData[\OC\Accounts\AccountManager::PROPERTY_DISPLAYNAME]['value']); + +$tmpl->assign('phone', $userData[\OC\Accounts\AccountManager::PROPERTY_PHONE]['value']); +$tmpl->assign('website', $userData[\OC\Accounts\AccountManager::PROPERTY_WEBSITE]['value']); +$tmpl->assign('twitter', $userData[\OC\Accounts\AccountManager::PROPERTY_TWITTER]['value']); +$tmpl->assign('address', $userData[\OC\Accounts\AccountManager::PROPERTY_ADDRESS]['value']); + +$tmpl->assign('avatarScope', $userData[\OC\Accounts\AccountManager::PROPERTY_AVATAR]['scope']); +$tmpl->assign('displayNameScope', $userData[\OC\Accounts\AccountManager::PROPERTY_DISPLAYNAME]['scope']); +$tmpl->assign('phoneScope', $userData[\OC\Accounts\AccountManager::PROPERTY_PHONE]['scope']); +$tmpl->assign('emailScope', $userData[\OC\Accounts\AccountManager::PROPERTY_EMAIL]['scope']); +$tmpl->assign('websiteScope', $userData[\OC\Accounts\AccountManager::PROPERTY_WEBSITE]['scope']); +$tmpl->assign('twitterScope', $userData[\OC\Accounts\AccountManager::PROPERTY_TWITTER]['scope']); +$tmpl->assign('addressScope', $userData[\OC\Accounts\AccountManager::PROPERTY_ADDRESS]['scope']); $tmpl->assign('enableAvatars', $config->getSystemValue('enable_avatars', true) === true); $tmpl->assign('avatarChangeSupported', OC_User::canUserChangeAvatar(OC_User::getUser())); diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 2db0cfa4882..01f114d9e95 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -83,11 +83,12 @@ if($_['displayNameChangeSupported']) {

- +

+ +
+
+

+ + +

+ +
+ +

@@ -128,6 +145,7 @@ if($_['displayNameChangeSupported']) {

+
+

t('Twitter')); ?>

+ t('No twitter handle set')); }?> +

t('Address')); ?>

t('No address set')); }?> -- 2.39.5