diff options
author | jmarshallnz <jcmarsha@gmail.com> | 2014-04-06 08:33:21 +1200 |
---|---|---|
committer | Trent Nelson <trent.a.b.nelson@gmail.com> | 2014-04-10 11:40:05 -0600 |
commit | 02eb861a32627510f0a418b97c733b85c0b2e015 (patch) | |
tree | 782f9dd7b1938e545c283f4d11dc9754996e81aa | |
parent | d3b42e4894b7bc831cf04636be045d6567f1feaf (diff) |
Merge pull request #4517 from t-nelson/no_invisible_or_disabled_settings_for_json
Don't expose invisible settings to JSONRPC
-rw-r--r-- | xbmc/interfaces/json-rpc/SettingsOperations.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/xbmc/interfaces/json-rpc/SettingsOperations.cpp b/xbmc/interfaces/json-rpc/SettingsOperations.cpp index c564ba682c..07094f744c 100644 --- a/xbmc/interfaces/json-rpc/SettingsOperations.cpp +++ b/xbmc/interfaces/json-rpc/SettingsOperations.cpp @@ -115,11 +115,14 @@ JSONRPC_STATUS CSettingsOperations::GetCategories(const CStdString &method, ITra SettingList settings = (*itGroup)->GetSettings(level); for (SettingList::const_iterator itSetting = settings.begin(); itSetting != settings.end(); ++itSetting) { - CVariant varSetting(CVariant::VariantTypeObject); - if (!SerializeSetting(*itSetting, varSetting)) - continue; - - varGroup["settings"].push_back(varSetting); + if ((*itSetting)->IsVisible()) + { + CVariant varSetting(CVariant::VariantTypeObject); + if (!SerializeSetting(*itSetting, varSetting)) + continue; + + varGroup["settings"].push_back(varSetting); + } } varCategory["groups"].push_back(varGroup); @@ -174,11 +177,14 @@ JSONRPC_STATUS CSettingsOperations::GetSettings(const CStdString &method, ITrans SettingList settings = (*itGroup)->GetSettings(level); for (SettingList::const_iterator itSetting = settings.begin(); itSetting != settings.end(); ++itSetting) { - CVariant varSetting(CVariant::VariantTypeObject); - if (!SerializeSetting(*itSetting, varSetting)) - continue; - - result["settings"].push_back(varSetting); + if ((*itSetting)->IsVisible()) + { + CVariant varSetting(CVariant::VariantTypeObject); + if (!SerializeSetting(*itSetting, varSetting)) + continue; + + result["settings"].push_back(varSetting); + } } } found = true; @@ -200,7 +206,8 @@ JSONRPC_STATUS CSettingsOperations::GetSettingValue(const CStdString &method, IT string settingId = parameterObject["setting"].asString(); CSetting* setting = CSettings::Get().GetSetting(settingId); - if (setting == NULL) + if (setting == NULL || + !setting->IsVisible()) return InvalidParams; CVariant value; @@ -245,7 +252,8 @@ JSONRPC_STATUS CSettingsOperations::SetSettingValue(const CStdString &method, IT CVariant value = parameterObject["value"]; CSetting* setting = CSettings::Get().GetSetting(settingId); - if (setting == NULL) + if (setting == NULL || + !setting->IsVisible()) return InvalidParams; switch (setting->GetType()) @@ -305,7 +313,8 @@ JSONRPC_STATUS CSettingsOperations::ResetSettingValue(const CStdString &method, string settingId = parameterObject["setting"].asString(); CSetting* setting = CSettings::Get().GetSetting(settingId); - if (setting == NULL) + if (setting == NULL || + !setting->IsVisible()) return InvalidParams; switch (setting->GetType()) |