Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/registration.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-04-01 10:41:04 +0300
committerJoas Schilling <coding@schilljs.com>2021-04-01 10:41:04 +0300
commit2d08501be7e833ea88e36e1b90b4d7ef24f0dd9d (patch)
tree9829774a35e83f1990ea5bfafc2a8239060fc0cf /lib/Settings/RegistrationSettings.php
parent1246f0a77fcc51cc264845788cb05d30105eda2f (diff)
Only allow phone when we can save it
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Settings/RegistrationSettings.php')
-rw-r--r--lib/Settings/RegistrationSettings.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Settings/RegistrationSettings.php b/lib/Settings/RegistrationSettings.php
index edebd13..66b0a48 100644
--- a/lib/Settings/RegistrationSettings.php
+++ b/lib/Settings/RegistrationSettings.php
@@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OCA\Registration\Settings;
use OCA\Registration\AppInfo\Application;
+use OCP\Accounts\IAccountManager;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\IConfig;
@@ -38,6 +39,8 @@ class RegistrationSettings implements ISettings {
private $config;
/** @var IGroupManager */
private $groupManager;
+ /** @var IAccountManager */
+ private $accountManager;
/** @var IInitialState */
private $initialState;
/** @var string */
@@ -46,10 +49,12 @@ class RegistrationSettings implements ISettings {
public function __construct(string $appName,
IConfig $config,
IGroupManager $groupManager,
+ IAccountManager $accountManager,
IInitialState $initialState) {
$this->appName = $appName;
$this->config = $config;
$this->groupManager = $groupManager;
+ $this->accountManager = $accountManager;
$this->initialState = $initialState;
}
@@ -101,6 +106,11 @@ class RegistrationSettings implements ISettings {
'enforce_fullname',
$this->config->getAppValue($this->appName, 'enforce_fullname', 'no') === 'yes'
);
+ // FIXME Always true when Nextcloud 22 or 21.0.1 is minimum requirement
+ $this->initialState->provideInitialState(
+ 'can_show_phone',
+ method_exists($this->accountManager, 'updateAccount')
+ );
$this->initialState->provideInitialState(
'show_phone',
$this->config->getAppValue($this->appName, 'show_phone', 'no') === 'yes'