mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
flag settings in description as being excluded from backups
This commit is contained in:
parent
9f2015ba46
commit
3516a8939a
3 changed files with 22 additions and 13 deletions
|
@ -9,7 +9,8 @@
|
|||
"name": "access_token",
|
||||
"label": "Access Token",
|
||||
"help": "This is your OAuth access token to connect this domain-server with your High Fidelity account. <br/>It can be generated by clicking the 'Connect Account' button above.<br/>You can also go to the <a href='https://metaverse.highfidelity.com/user/security' target='_blank'>My Security</a> page of your account and generate a token with the 'domains' scope and paste it here.",
|
||||
"advanced": true
|
||||
"advanced": true,
|
||||
"backup": false
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
|
@ -159,7 +160,8 @@
|
|||
{
|
||||
"name": "http_username",
|
||||
"label": "HTTP Username",
|
||||
"help": "Username used for basic HTTP authentication."
|
||||
"help": "Username used for basic HTTP authentication.",
|
||||
"backup": false
|
||||
},
|
||||
{
|
||||
"name": "http_password",
|
||||
|
@ -167,7 +169,8 @@
|
|||
"type": "password",
|
||||
"help": "Password used for basic HTTP authentication. Leave this alone if you do not want to change it.",
|
||||
"password_placeholder": "******",
|
||||
"value-hidden": true
|
||||
"value-hidden": true,
|
||||
"backup": false
|
||||
},
|
||||
{
|
||||
"name": "verify_http_password",
|
||||
|
|
|
@ -40,6 +40,7 @@ const QString DESCRIPTION_SETTINGS_KEY = "settings";
|
|||
const QString SETTING_DEFAULT_KEY = "default";
|
||||
const QString DESCRIPTION_NAME_KEY = "name";
|
||||
const QString DESCRIPTION_GROUP_LABEL_KEY = "label";
|
||||
const QString DESCRIPTION_BACKUP_FLAG_KEY = "backup";
|
||||
const QString SETTING_DESCRIPTION_TYPE_KEY = "type";
|
||||
const QString DESCRIPTION_COLUMNS_KEY = "columns";
|
||||
const QString CONTENT_SETTING_FLAG_KEY = "content_setting";
|
||||
|
@ -1173,7 +1174,7 @@ bool DomainServerSettingsManager::handleAuthenticatedHTTPRequest(HTTPConnection
|
|||
} else if (url.path() == SETTINGS_BACKUP_PATH) {
|
||||
// grab the settings backup as an authenticated user
|
||||
// for the domain settings type only, excluding hidden and default values
|
||||
auto currentDomainSettingsJSON = settingsResponseObjectForType("", true, true, false, false);
|
||||
auto currentDomainSettingsJSON = settingsResponseObjectForType("", true, true, false, false, true);
|
||||
|
||||
// setup headers that tell the client to download the file wth a special name
|
||||
Headers downloadHeaders;
|
||||
|
@ -1240,13 +1241,15 @@ bool DomainServerSettingsManager::restoreSettingsFromObject(QJsonObject settings
|
|||
}
|
||||
|
||||
foreach(const QJsonValue& descriptionSettingValue, descriptionGroupSettings) {
|
||||
const QString VALUE_HIDDEN_FLAG_KEY = "value-hidden";
|
||||
|
||||
QJsonObject descriptionSettingObject = descriptionSettingValue.toObject();
|
||||
|
||||
// we'll override this setting with the default or what is in the restore as long as it isn't hidden
|
||||
if (!descriptionSettingObject[VALUE_HIDDEN_FLAG_KEY].toBool()) {
|
||||
// we'll override this setting with the default or what is in the restore as long as
|
||||
// it isn't specifically excluded from backups
|
||||
bool isBackedUpSetting = !descriptionSettingObject.contains(DESCRIPTION_BACKUP_FLAG_KEY)
|
||||
|| descriptionSettingObject[DESCRIPTION_BACKUP_FLAG_KEY].toBool();
|
||||
|
||||
if (isBackedUpSetting) {
|
||||
QString settingName = descriptionSettingObject[DESCRIPTION_NAME_KEY].toString();
|
||||
|
||||
// check if we have a matching setting for this in the restore
|
||||
|
@ -1315,7 +1318,7 @@ bool DomainServerSettingsManager::restoreSettingsFromObject(QJsonObject settings
|
|||
QJsonObject DomainServerSettingsManager::settingsResponseObjectForType(const QString& typeValue, bool isAuthenticated,
|
||||
bool includeDomainSettings,
|
||||
bool includeContentSettings,
|
||||
bool includeDefaults) {
|
||||
bool includeDefaults, bool isForBackup) {
|
||||
QJsonObject responseObject;
|
||||
|
||||
if (!typeValue.isEmpty() || isAuthenticated) {
|
||||
|
@ -1347,7 +1350,11 @@ QJsonObject DomainServerSettingsManager::settingsResponseObjectForType(const QSt
|
|||
QJsonObject settingObject = settingValue.toObject();
|
||||
|
||||
// consider this setting as long as it isn't hidden
|
||||
if (!settingObject[VALUE_HIDDEN_FLAG_KEY].toBool()) {
|
||||
// and either this isn't for a backup or it's a value included in backups
|
||||
bool includedInBackups = !settingObject.contains(DESCRIPTION_BACKUP_FLAG_KEY)
|
||||
|| settingObject[DESCRIPTION_BACKUP_FLAG_KEY].toBool();
|
||||
|
||||
if (!settingObject[VALUE_HIDDEN_FLAG_KEY].toBool() && (!isForBackup || includedInBackups)) {
|
||||
QJsonArray affectedTypesArray = settingObject[AFFECTED_TYPES_JSON_KEY].toArray();
|
||||
if (affectedTypesArray.isEmpty()) {
|
||||
affectedTypesArray = groupObject[AFFECTED_TYPES_JSON_KEY].toArray();
|
||||
|
@ -1370,8 +1377,8 @@ QJsonObject DomainServerSettingsManager::settingsResponseObjectForType(const QSt
|
|||
variantValue = _configMap.value(settingName);
|
||||
}
|
||||
|
||||
// final check for inclusion, either we include default values
|
||||
// or we don't but this isn't a default value
|
||||
// final check for inclusion
|
||||
// either we include default values or we don't but this isn't a default value
|
||||
if (includeDefaults || !variantValue.isNull()) {
|
||||
QJsonValue result;
|
||||
|
||||
|
@ -1407,7 +1414,6 @@ QJsonObject DomainServerSettingsManager::settingsResponseObjectForType(const QSt
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return responseObject;
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ private:
|
|||
QJsonArray filteredDescriptionArray(bool isContentSettings);
|
||||
QJsonObject settingsResponseObjectForType(const QString& typeValue, bool isAuthenticated = false,
|
||||
bool includeDomainSettings = true, bool includeContentSettings = true,
|
||||
bool includeDefaults = true);
|
||||
bool includeDefaults = true, bool isForBackup = false);
|
||||
bool recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject, SettingsType settingsType);
|
||||
|
||||
void updateSetting(const QString& key, const QJsonValue& newValue, QVariantMap& settingMap,
|
||||
|
|
Loading…
Reference in a new issue