use OCP\Accounts\IAccountManager;
use OCP\Accounts\IAccountProperty;
use OCP\Accounts\PropertyDoesNotExistException;
-use OCP\App\IAppManager;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCS\OCSException;
class UsersController extends AUserData {
- /** @var IAppManager */
- private $appManager;
/** @var IURLGenerator */
protected $urlGenerator;
/** @var LoggerInterface */
IRequest $request,
IUserManager $userManager,
IConfig $config,
- IAppManager $appManager,
IGroupManager $groupManager,
IUserSession $userSession,
IAccountManager $accountManager,
$accountManager,
$l10nFactory);
- $this->appManager = $appManager;
$this->urlGenerator = $urlGenerator;
$this->logger = $logger;
$this->l10nFactory = $l10nFactory;
$mailCollection = $userAccount->getPropertyCollection(IAccountManager::COLLECTION_EMAIL);
$mailCollection->removePropertyByValue($key);
if ($value !== '') {
- // "replace on"
$mailCollection->addPropertyWithDefaults($value);
}
$this->accountManager->updateAccount($userAccount);
use OCP\Accounts\IAccount;
use OCP\Accounts\IAccountManager;
use OCP\Accounts\IAccountProperty;
-use OCP\App\IAppManager;
use OCP\AppFramework\Http\DataResponse;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
protected $userManager;
/** @var IConfig|MockObject */
protected $config;
- /** @var IAppManager|MockObject */
- protected $appManager;
/** @var Manager|MockObject */
protected $groupManager;
/** @var IUserSession|MockObject */
$this->userManager = $this->createMock(IUserManager::class);
$this->config = $this->createMock(IConfig::class);
- $this->appManager = $this->createMock(IAppManager::class);
$this->groupManager = $this->createMock(Manager::class);
$this->userSession = $this->createMock(IUserSession::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->request,
$this->userManager,
$this->config,
- $this->appManager,
$this->groupManager,
$this->userSession,
$this->accountManager,
$this->request,
$this->userManager,
$this->config,
- $this->appManager,
$this->groupManager,
$this->userSession,
$this->accountManager,
$this->request,
$this->userManager,
$this->config,
- $this->appManager,
$this->groupManager,
$this->userSession,
$this->accountManager,
$this->request,
$this->userManager,
$this->config,
- $this->appManager,
$this->groupManager,
$this->userSession,
$this->accountManager,
$updated = true;
if ($oldUserData !== $data) {
-
$this->updateExistingUser($user, $data);
} else {
// nothing needs to be done if new and old data set are the same
$userDataArray = $this->importFromJson($accountData[0]['data'], $uid);
if ($userDataArray === null || $userDataArray === []) {
-
return $this->buildDefaultUserRecord($user);
}
/**
* check if we need to ask the server for email verification, if yes we create a cronjob
-
+ *
*/
protected function checkEmailVerification(IAccount $updatedAccount, array $oldData): void {
try {
/**
* make sure that all expected data are set
-
+ *
*/
protected function addMissingDefaultValues(array $userData): array {
foreach ($userData as $i => $value) {
if (!isset($value['verified'])) {
$userData[$i]['verified'] = self::NOT_VERIFIED;
}
-
}
return $userData;
}
public function updateAccount(IAccount $account): void {
-
$this->testValueLengths(iterator_to_array($account->getAllProperties()), true);
try {
$property = $account->getProperty(self::PROPERTY_PHONE);
$this->updateUser($account->getUser(), $data, true);
}
-}
\ No newline at end of file
+}