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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2022-03-17 21:06:38 +0300
committerChristopher Ng <chrng8@gmail.com>2022-03-18 05:55:12 +0300
commit108abd77ed0ee29bca4019f6a212ba1b2bdad5e7 (patch)
tree3c2d3f2382b83eb93cae4f974d20bbbbe2b9789b /lib
parent1fc0b4320c8921ad59bf4d41a88bf9936e1f653d (diff)
Add profile default setting for admin
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Accounts/AccountManager.php5
-rw-r--r--lib/private/Profile/TProfileHelper.php15
2 files changed, 8 insertions, 12 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index 7f855c07d46..127adc9ef38 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -40,6 +40,7 @@ use libphonenumber\NumberParseException;
use libphonenumber\PhoneNumber;
use libphonenumber\PhoneNumberFormat;
use libphonenumber\PhoneNumberUtil;
+use OC\Profile\TProfileHelper;
use OCA\Settings\BackgroundJobs\VerifyUserData;
use OCP\Accounts\IAccount;
use OCP\Accounts\IAccountManager;
@@ -79,6 +80,8 @@ use function json_last_error;
class AccountManager implements IAccountManager {
use TAccountsHelper;
+ use TProfileHelper;
+
/** @var IDBConnection database connection */
private $connection;
@@ -722,7 +725,7 @@ class AccountManager implements IAccountManager {
[
'name' => self::PROPERTY_PROFILE_ENABLED,
- 'value' => '1',
+ 'value' => $this->isProfileEnabledByDefault($this->config) ? '1' : '0',
],
];
}
diff --git a/lib/private/Profile/TProfileHelper.php b/lib/private/Profile/TProfileHelper.php
index 0d4b5c6286e..5b57e1c9d5c 100644
--- a/lib/private/Profile/TProfileHelper.php
+++ b/lib/private/Profile/TProfileHelper.php
@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
- * @copyright 2021 Christopher Ng <chrng8@gmail.com>
+ * @copyright 2022 Christopher Ng <chrng8@gmail.com>
*
* @author Christopher Ng <chrng8@gmail.com>
*
@@ -26,19 +26,12 @@ declare(strict_types=1);
namespace OC\Profile;
-use OCP\Accounts\IAccount;
-use OCP\Accounts\IAccountManager;
+use OCP\IConfig;
trait TProfileHelper {
-
- /**
- * Returns whether the profile is enabled for the account
- *
- * @since 23.0.0
- */
- protected function isProfileEnabled(IAccount $account): ?bool {
+ protected function isProfileEnabledByDefault(IConfig $config): ?bool {
return filter_var(
- $account->getProperty(IAccountManager::PROPERTY_PROFILE_ENABLED)->getValue(),
+ $config->getAppValue('settings', 'profile_enabled_by_default', '1'),
FILTER_VALIDATE_BOOLEAN,
FILTER_NULL_ON_FAILURE,
);