From 381a4f9b531de97bdedeb1d8a7b0006006baadc0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 12 Mar 2021 13:25:16 +0100 Subject: [PATCH] [users] Add preset to users module Config --- src/modules/users/Config.cpp | 7 ++++++- src/modules/users/users.conf | 8 ++++++++ src/modules/users/users.schema.yaml | 12 ++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/modules/users/Config.cpp b/src/modules/users/Config.cpp index 165e21b9c..00aa257fa 100644 --- a/src/modules/users/Config.cpp +++ b/src/modules/users/Config.cpp @@ -16,6 +16,7 @@ #include "GlobalStorage.h" #include "JobQueue.h" +#include "modulesystem/Preset.h" #include "utils/Logger.h" #include "utils/String.h" #include "utils/Variant.h" @@ -105,7 +106,7 @@ Config::Config( QObject* parent ) connect( this, &Config::requireStrongPasswordsChanged, this, &Config::checkReady ); } -Config::~Config() { } +Config::~Config() {} void Config::setUserShell( const QString& shell ) @@ -836,6 +837,10 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) updateGSAutoLogin( doAutoLogin(), loginName() ); checkReady(); + + bool bogus = true; + Calamares::ModuleSystem::Presets p( CalamaresUtils::getSubMap( configurationMap, "presets", bogus ), + { "fullname", "loginname", } ); } void diff --git a/src/modules/users/users.conf b/src/modules/users/users.conf index 2e09ae123..b137a135a 100644 --- a/src/modules/users/users.conf +++ b/src/modules/users/users.conf @@ -159,3 +159,11 @@ setHostname: EtcFile # (also adds localhost and some ipv6 standard entries). # Defaults to *true*. writeHostsFile: true + +presets: + fullname: + value: "OEM User" + editable: false + loginname: + value: "oem" + editable: false diff --git a/src/modules/users/users.schema.yaml b/src/modules/users/users.schema.yaml index 81088032c..5870a7e0a 100644 --- a/src/modules/users/users.schema.yaml +++ b/src/modules/users/users.schema.yaml @@ -43,6 +43,18 @@ properties: setHostname: { type: string, enum: [ None, EtcFile, Hostnamed ] } writeHostsFile: { type: boolean, default: true } + # Presets + # + # TODO: lift up somewhere, since this will return in many modules; + # the type for each field (fullname, loginname) is a + # preset-description (value, editable). + presets: + type: object + additionalProperties: false + properties: + fullname: { type: object } + loginname: { type: object } + required: - defaultGroups - autologinGroup