fix(settings): keep the server URL locked in builds that enforce it
- A device default no longer unlocks the server URL in a build that sets APPLICATION_SERVER_URL together with APPLICATION_SERVER_URL_ENFORCE. Standard builds enable APPLICATION_SERVER_URL_ENFORCE without a URL, so a device default stays editable there. - Say "Invalid path" when --overridelocaldir is given without a path. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Nathan van Dael <[email protected]>
This commit is contained in:
1 parent
f209efb1ec
commit
7d4ee3f6b6
4 files changed
+20
-5
No files matched your search
@@ -125,7 +125,9 @@ schema, so a policy can not enforce a setting the client did not declare.
|
||||
device default prefills every new account setup and stays editable, while a device
|
||||
policy or `--overrideserverurl` locks the server URL and starts the login flow. The
|
||||
wizard removes the user value after an account is added, so a command line override
|
||||
applies once and a device default applies again. Only a locked server URL restricts
|
||||
applies once and a device default applies again. A build that sets
|
||||
`APPLICATION_SERVER_URL` with `APPLICATION_SERVER_URL_ENFORCE` also locks a device
|
||||
default. Only a locked server URL restricts
|
||||
which servers `nc://login` links may open. An `overrideLocalDir` from device default
|
||||
or policy applies only to the first account, in the wizard and for an account set up
|
||||
from the command line, and a device default folder stays editable. `--overridelocaldir`
|
||||
|
||||
@@ -1105,7 +1105,7 @@ void Application::parseOptions(const QStringList &options)
|
||||
_overrideLocalDir = overrideLocalDir;
|
||||
}
|
||||
} else {
|
||||
showHint("Invalid URL passed to --overridelocaldir");
|
||||
showHint("Invalid path passed to --overridelocaldir");
|
||||
}
|
||||
} else if (option == QStringLiteral("--set-language")) {
|
||||
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "clientproxy.h"
|
||||
#include "common/utility.h"
|
||||
#include "common/vfs.h"
|
||||
#include "config.h"
|
||||
#include "configfile.h"
|
||||
#include "creds/credentialsfactory.h"
|
||||
#include "creds/httpcredentialsgui.h"
|
||||
@@ -64,6 +65,12 @@ Q_LOGGING_CATEGORY(lcAccountWizardController, "nextcloud.gui.accountwizardcontro
|
||||
|
||||
namespace {
|
||||
|
||||
#if defined(APPLICATION_SERVER_URL) && defined(APPLICATION_SERVER_URL_ENFORCE)
|
||||
constexpr auto buildEnforcesServerUrl = true;
|
||||
#else
|
||||
constexpr auto buildEnforcesServerUrl = false;
|
||||
#endif
|
||||
|
||||
bool localFolderContainsData(const QString &localSyncFolder)
|
||||
{
|
||||
const auto localFolder = QDir(localSyncFolder);
|
||||
@@ -141,7 +148,7 @@ void AccountWizardController::initialiseAccount()
|
||||
Theme::instance()->setForceOverrideServerUrl(true);
|
||||
Theme::instance()->setStartLoginFlowAutomatically(true);
|
||||
} else {
|
||||
Theme::instance()->setForceOverrideServerUrl(false);
|
||||
Theme::instance()->setForceOverrideServerUrl(buildEnforcesServerUrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "account.h"
|
||||
#include "accountmanager.h"
|
||||
#include "config.h"
|
||||
#include "configfile.h"
|
||||
#include "folder.h"
|
||||
#include "gui/localnetworkpermission.h"
|
||||
@@ -640,7 +641,7 @@ private Q_SLOTS:
|
||||
QVERIFY(controller.startLoginFlowAutomatically());
|
||||
}
|
||||
|
||||
void prefillsEditableServerUrlFromManagedDefault()
|
||||
void prefillsServerUrlFromManagedDefault()
|
||||
{
|
||||
const auto restoreConfiguration = restoreOverrideState();
|
||||
setManagedOverrideServerUrl(SettingSourceType::PlatformDefault, EnforcementState::NotEnforced, 20);
|
||||
@@ -648,9 +649,14 @@ private Q_SLOTS:
|
||||
AccountWizardController controller;
|
||||
|
||||
QCOMPARE(controller.serverUrl(), u"https://cloud.example"_s);
|
||||
#if defined(APPLICATION_SERVER_URL) && defined(APPLICATION_SERVER_URL_ENFORCE)
|
||||
QVERIFY(!controller.serverUrlEditable());
|
||||
QVERIFY(Theme::instance()->forceOverrideServerUrl());
|
||||
#else
|
||||
QVERIFY(controller.serverUrlEditable());
|
||||
QVERIFY(!controller.startLoginFlowAutomatically());
|
||||
QVERIFY(!Theme::instance()->forceOverrideServerUrl());
|
||||
#endif
|
||||
QVERIFY(!controller.startLoginFlowAutomatically());
|
||||
}
|
||||
|
||||
void locksServerUrlFromManagedPolicy()
|
||||
|
||||
Reference in new issue
Block a user