diff options
Diffstat (limited to 'lib/private/Template')
-rw-r--r-- | lib/private/Template/JSCombiner.php | 1 | ||||
-rw-r--r-- | lib/private/Template/JSConfigHelper.php | 11 | ||||
-rw-r--r-- | lib/private/Template/JSResourceLocator.php | 2 | ||||
-rw-r--r-- | lib/private/Template/functions.php | 23 |
4 files changed, 14 insertions, 23 deletions
diff --git a/lib/private/Template/JSCombiner.php b/lib/private/Template/JSCombiner.php index 5fce3effb3f..a94f822a448 100644 --- a/lib/private/Template/JSCombiner.php +++ b/lib/private/Template/JSCombiner.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index 5743d2965d2..07e557d0706 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -30,6 +30,7 @@ use OCP\ILogger; use OCP\ISession; use OCP\IURLGenerator; use OCP\IUser; +use OCP\Server; use OCP\ServerVersion; use OCP\Session\Exceptions\SessionNotAvailableException; use OCP\Share\IManager as IShareManager; @@ -66,9 +67,11 @@ class JSConfigHelper { $backend = $this->currentUser->getBackend(); if ($backend instanceof IPasswordConfirmationBackend) { - $userBackendAllowsPasswordConfirmation = $backend->canConfirmPassword($uid); + $userBackendAllowsPasswordConfirmation = $backend->canConfirmPassword($uid) && $this->canUserValidatePassword(); } elseif (isset($this->excludedUserBackEnds[$this->currentUser->getBackendClassName()])) { $userBackendAllowsPasswordConfirmation = false; + } else { + $userBackendAllowsPasswordConfirmation = $this->canUserValidatePassword(); } } else { $uid = null; @@ -161,6 +164,8 @@ class JSConfigHelper { 'enable_non-accessible_features' => $this->config->getSystemValueBool('enable_non-accessible_features', true), ]; + $shareManager = Server::get(IShareManager::class); + $array = [ '_oc_debug' => $this->config->getSystemValue('debug', false) ? 'true' : 'false', '_oc_isadmin' => $uid !== null && $this->groupManager->isAdmin($uid) ? 'true' : 'false', @@ -235,11 +240,11 @@ class JSConfigHelper { 'defaultExpireDateEnforced' => $enforceDefaultExpireDate, 'enforcePasswordForPublicLink' => Util::isPublicLinkPasswordRequired(), 'enableLinkPasswordByDefault' => $enableLinkPasswordByDefault, - 'sharingDisabledForUser' => Util::isSharingDisabledForUser(), + 'sharingDisabledForUser' => $shareManager->sharingDisabledForUser($uid), 'resharingAllowed' => Share::isResharingAllowed(), 'remoteShareAllowed' => $outgoingServer2serverShareEnabled, 'federatedCloudShareDoc' => $this->urlGenerator->linkToDocs('user-sharing-federated'), - 'allowGroupSharing' => \OC::$server->get(IShareManager::class)->allowGroupSharing(), + 'allowGroupSharing' => $shareManager->allowGroupSharing(), 'defaultInternalExpireDateEnabled' => $defaultInternalExpireDateEnabled, 'defaultInternalExpireDate' => $defaultInternalExpireDate, 'defaultInternalExpireDateEnforced' => $defaultInternalExpireDateEnforced, diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php index aad999f939a..a6d2d13a2ad 100644 --- a/lib/private/Template/JSResourceLocator.php +++ b/lib/private/Template/JSResourceLocator.php @@ -69,7 +69,7 @@ class JSResourceLocator extends ResourceLocator { || $this->appendScriptIfExist($this->serverroot, "dist/$app-$scriptName") || $this->appendScriptIfExist($appRoot, $script, $appWebRoot) || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $script . '.json') - || $this->cacheAndAppendCombineJsonIfExist($appRoot, $script . '.json', $appWebRoot) + || $this->cacheAndAppendCombineJsonIfExist($appRoot, $script . '.json', $app) || $this->appendScriptIfExist($this->serverroot, $theme_dir . 'core/' . $script) || $this->appendScriptIfExist($this->serverroot, 'core/' . $script) || (strpos($scriptName, '/') === -1 && ($this->appendScriptIfExist($this->serverroot, $theme_dir . "dist/core-$scriptName") diff --git a/lib/private/Template/functions.php b/lib/private/Template/functions.php index 957aaee2237..402a7491e03 100644 --- a/lib/private/Template/functions.php +++ b/lib/private/Template/functions.php @@ -123,22 +123,6 @@ function script($app, $file = null): void { } /** - * Shortcut for adding vendor scripts to a page - * @param string $app the appname - * @param string|string[] $file the filename, - * if an array is given it will add all scripts - */ -function vendor_script($app, $file = null): void { - if (is_array($file)) { - foreach ($file as $f) { - OC_Util::addVendorScript($app, $f); - } - } else { - OC_Util::addVendorScript($app, $file); - } -} - -/** * Shortcut for adding styles to a page * @param string $app the appname * @param string|string[] $file the filename, @@ -147,10 +131,10 @@ function vendor_script($app, $file = null): void { function style($app, $file = null): void { if (is_array($file)) { foreach ($file as $f) { - OC_Util::addStyle($app, $f); + Util::addStyle($app, $f); } } else { - OC_Util::addStyle($app, $file); + Util::addStyle($app, $file); } } @@ -159,6 +143,7 @@ function style($app, $file = null): void { * @param string $app the appname * @param string|string[] $file the filename, * if an array is given it will add all styles + * @deprecated 32.0.0 */ function vendor_style($app, $file = null): void { if (is_array($file)) { @@ -176,7 +161,7 @@ function vendor_style($app, $file = null): void { * if an array is given it will add all styles */ function translation($app): void { - OC_Util::addTranslations($app); + Util::addTranslations($app); } /** |