mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-17 20:26:16 +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",
|
"name": "access_token",
|
||||||
"label": "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.",
|
"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",
|
"name": "id",
|
||||||
|
@ -159,7 +160,8 @@
|
||||||
{
|
{
|
||||||
"name": "http_username",
|
"name": "http_username",
|
||||||
"label": "HTTP Username",
|
"label": "HTTP Username",
|
||||||
"help": "Username used for basic HTTP authentication."
|
"help": "Username used for basic HTTP authentication.",
|
||||||
|
"backup": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "http_password",
|
"name": "http_password",
|
||||||
|
@ -167,7 +169,8 @@
|
||||||
"type": "password",
|
"type": "password",
|
||||||
"help": "Password used for basic HTTP authentication. Leave this alone if you do not want to change it.",
|
"help": "Password used for basic HTTP authentication. Leave this alone if you do not want to change it.",
|
||||||
"password_placeholder": "******",
|
"password_placeholder": "******",
|
||||||
"value-hidden": true
|
"value-hidden": true,
|
||||||
|
"backup": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "verify_http_password",
|
"name": "verify_http_password",
|
||||||
|
|
|
@ -40,6 +40,7 @@ const QString DESCRIPTION_SETTINGS_KEY = "settings";
|
||||||
const QString SETTING_DEFAULT_KEY = "default";
|
const QString SETTING_DEFAULT_KEY = "default";
|
||||||
const QString DESCRIPTION_NAME_KEY = "name";
|
const QString DESCRIPTION_NAME_KEY = "name";
|
||||||
const QString DESCRIPTION_GROUP_LABEL_KEY = "label";
|
const QString DESCRIPTION_GROUP_LABEL_KEY = "label";
|
||||||
|
const QString DESCRIPTION_BACKUP_FLAG_KEY = "backup";
|
||||||
const QString SETTING_DESCRIPTION_TYPE_KEY = "type";
|
const QString SETTING_DESCRIPTION_TYPE_KEY = "type";
|
||||||
const QString DESCRIPTION_COLUMNS_KEY = "columns";
|
const QString DESCRIPTION_COLUMNS_KEY = "columns";
|
||||||
const QString CONTENT_SETTING_FLAG_KEY = "content_setting";
|
const QString CONTENT_SETTING_FLAG_KEY = "content_setting";
|
||||||
|
@ -1173,7 +1174,7 @@ bool DomainServerSettingsManager::handleAuthenticatedHTTPRequest(HTTPConnection
|
||||||
} else if (url.path() == SETTINGS_BACKUP_PATH) {
|
} else if (url.path() == SETTINGS_BACKUP_PATH) {
|
||||||
// grab the settings backup as an authenticated user
|
// grab the settings backup as an authenticated user
|
||||||
// for the domain settings type only, excluding hidden and default values
|
// 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
|
// setup headers that tell the client to download the file wth a special name
|
||||||
Headers downloadHeaders;
|
Headers downloadHeaders;
|
||||||
|
@ -1240,13 +1241,15 @@ bool DomainServerSettingsManager::restoreSettingsFromObject(QJsonObject settings
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(const QJsonValue& descriptionSettingValue, descriptionGroupSettings) {
|
foreach(const QJsonValue& descriptionSettingValue, descriptionGroupSettings) {
|
||||||
const QString VALUE_HIDDEN_FLAG_KEY = "value-hidden";
|
|
||||||
|
|
||||||
QJsonObject descriptionSettingObject = descriptionSettingValue.toObject();
|
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
|
// we'll override this setting with the default or what is in the restore as long as
|
||||||
if (!descriptionSettingObject[VALUE_HIDDEN_FLAG_KEY].toBool()) {
|
// 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();
|
QString settingName = descriptionSettingObject[DESCRIPTION_NAME_KEY].toString();
|
||||||
|
|
||||||
// check if we have a matching setting for this in the restore
|
// 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,
|
QJsonObject DomainServerSettingsManager::settingsResponseObjectForType(const QString& typeValue, bool isAuthenticated,
|
||||||
bool includeDomainSettings,
|
bool includeDomainSettings,
|
||||||
bool includeContentSettings,
|
bool includeContentSettings,
|
||||||
bool includeDefaults) {
|
bool includeDefaults, bool isForBackup) {
|
||||||
QJsonObject responseObject;
|
QJsonObject responseObject;
|
||||||
|
|
||||||
if (!typeValue.isEmpty() || isAuthenticated) {
|
if (!typeValue.isEmpty() || isAuthenticated) {
|
||||||
|
@ -1347,7 +1350,11 @@ QJsonObject DomainServerSettingsManager::settingsResponseObjectForType(const QSt
|
||||||
QJsonObject settingObject = settingValue.toObject();
|
QJsonObject settingObject = settingValue.toObject();
|
||||||
|
|
||||||
// consider this setting as long as it isn't hidden
|
// 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();
|
QJsonArray affectedTypesArray = settingObject[AFFECTED_TYPES_JSON_KEY].toArray();
|
||||||
if (affectedTypesArray.isEmpty()) {
|
if (affectedTypesArray.isEmpty()) {
|
||||||
affectedTypesArray = groupObject[AFFECTED_TYPES_JSON_KEY].toArray();
|
affectedTypesArray = groupObject[AFFECTED_TYPES_JSON_KEY].toArray();
|
||||||
|
@ -1370,8 +1377,8 @@ QJsonObject DomainServerSettingsManager::settingsResponseObjectForType(const QSt
|
||||||
variantValue = _configMap.value(settingName);
|
variantValue = _configMap.value(settingName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// final check for inclusion, either we include default values
|
// final check for inclusion
|
||||||
// or we don't but this isn't a default value
|
// either we include default values or we don't but this isn't a default value
|
||||||
if (includeDefaults || !variantValue.isNull()) {
|
if (includeDefaults || !variantValue.isNull()) {
|
||||||
QJsonValue result;
|
QJsonValue result;
|
||||||
|
|
||||||
|
@ -1407,7 +1414,6 @@ QJsonObject DomainServerSettingsManager::settingsResponseObjectForType(const QSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return responseObject;
|
return responseObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ private:
|
||||||
QJsonArray filteredDescriptionArray(bool isContentSettings);
|
QJsonArray filteredDescriptionArray(bool isContentSettings);
|
||||||
QJsonObject settingsResponseObjectForType(const QString& typeValue, bool isAuthenticated = false,
|
QJsonObject settingsResponseObjectForType(const QString& typeValue, bool isAuthenticated = false,
|
||||||
bool includeDomainSettings = true, bool includeContentSettings = true,
|
bool includeDomainSettings = true, bool includeContentSettings = true,
|
||||||
bool includeDefaults = true);
|
bool includeDefaults = true, bool isForBackup = false);
|
||||||
bool recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject, SettingsType settingsType);
|
bool recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject, SettingsType settingsType);
|
||||||
|
|
||||||
void updateSetting(const QString& key, const QJsonValue& newValue, QVariantMap& settingMap,
|
void updateSetting(const QString& key, const QJsonValue& newValue, QVariantMap& settingMap,
|
||||||
|
|
Loading…
Reference in a new issue