diff options
author | Andrey Oleynik <aoleynik@luxoft.com> | 2017-08-18 10:04:26 +0300 |
---|---|---|
committer | Andrey Oleynik <aoleynik@luxoft.com> | 2017-08-21 15:59:12 +0300 |
commit | 95cd13ab779dea195ee06e1f423f73003514c7b9 (patch) | |
tree | 8f536a968e4329e3b8e8be96661c923170fce59b /src/components/policy/policy_external/src | |
parent | 482c91a6f3d35eb0cca14d89629472c5bd2eab31 (diff) | |
download | sdl_core-95cd13ab779dea195ee06e1f423f73003514c7b9.tar.gz |
Removes 'country_consent_passengerRC' support
Diffstat (limited to 'src/components/policy/policy_external/src')
5 files changed, 9 insertions, 59 deletions
diff --git a/src/components/policy/policy_external/src/access_remote_impl.cc b/src/components/policy/policy_external/src/access_remote_impl.cc index 929d9eb1d8..789e12feda 100644 --- a/src/components/policy/policy_external/src/access_remote_impl.cc +++ b/src/components/policy/policy_external/src/access_remote_impl.cc @@ -121,8 +121,7 @@ void AccessRemoteImpl::Init() { DCHECK(cache_->pt_); policy_table::ModuleConfig& config = cache_->pt_->policy_table.module_config; - enabled_ = country_consent() && - (!config.user_consent_passengersRC.is_initialized() || + enabled_ = (!config.user_consent_passengersRC.is_initialized() || *config.user_consent_passengersRC); } @@ -257,17 +256,11 @@ void AccessRemoteImpl::Disable() { } void AccessRemoteImpl::set_enabled(bool value) { - enabled_ = country_consent() && value; + enabled_ = value; *cache_->pt_->policy_table.module_config.user_consent_passengersRC = value; cache_->Backup(); } -bool AccessRemoteImpl::country_consent() const { - policy_table::ModuleConfig& config = cache_->pt_->policy_table.module_config; - return !config.country_consent_passengersRC.is_initialized() || - *config.country_consent_passengersRC; -} - bool AccessRemoteImpl::IsEnabled() const { LOG4CXX_AUTO_TRACE(logger_); return enabled_; diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index d968912725..82ef7b8e6c 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -2189,30 +2189,11 @@ bool PolicyManagerImpl::CheckPTURemoteCtrlChange( const utils::SharedPtr<policy_table::Table> snapshot) { LOG4CXX_AUTO_TRACE(logger_); - rpc::Optional<rpc::Boolean>& new_consent = - pt_update->policy_table.module_config.country_consent_passengersRC; - rpc::Optional<rpc::Boolean>& old_consent = - snapshot->policy_table.module_config.country_consent_passengersRC; + // TODO: Rework - if (!new_consent.is_initialized() && !old_consent.is_initialized()) { - return false; - } - - bool result = false; - if (new_consent.is_initialized() && old_consent.is_initialized()) { - result = (*new_consent != *old_consent); - } else { - bool not_changed_consent1 = !new_consent.is_initialized() && *old_consent; - bool not_changed_consent2 = !old_consent.is_initialized() && *new_consent; - - result = !(not_changed_consent1 || not_changed_consent2); - } - - if (result) { - listener()->OnRemoteAllowedChanged(result); - } - - return result; + const bool is_allowed = true; + listener()->OnRemoteAllowedChanged(is_allowed); + return is_allowed; } void PolicyManagerImpl::CheckRemoteGroupsChange( diff --git a/src/components/policy/policy_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc index 5c962cc4da..5d41e626fd 100644 --- a/src/components/policy/policy_external/src/policy_table/types.cc +++ b/src/components/policy/policy_external/src/policy_table/types.cc @@ -605,8 +605,6 @@ ModuleConfig::ModuleConfig(const Json::Value* value__) #ifdef SDL_REMOTE_CONTROL , user_consent_passengersRC( impl::ValueMember(value__, "user_consent_passengersRC")) - , country_consent_passengersRC( - impl::ValueMember(value__, "country_consent_passengersRC")) #endif // SDL_REMOTE_CONTROL { } @@ -628,8 +626,6 @@ void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) { vehicle_year.assign_if_valid(from.vehicle_year); #ifdef SDL_REMOTE_CONTROL user_consent_passengersRC.assign_if_valid(from.user_consent_passengersRC); - country_consent_passengersRC.assign_if_valid( - from.country_consent_passengersRC); #endif // SDL_REMOTE_CONTROL } @@ -660,8 +656,6 @@ Json::Value ModuleConfig::ToJsonValue() const { #ifdef SDL_REMOTE_CONTROL impl::WriteJsonField( "user_consent_passengersRC", user_consent_passengersRC, &result__); - impl::WriteJsonField( - "country_consent_passengersRC", country_consent_passengersRC, &result__); #endif // SDL_REMOTE_CONTROL return result__; } @@ -713,9 +707,6 @@ bool ModuleConfig::is_valid() const { if (!user_consent_passengersRC.is_valid()) { return false; } - if (!country_consent_passengersRC.is_valid()) { - return false; - } #endif // SDL_REMOTE_CONTROL return Validate(); } @@ -770,9 +761,6 @@ bool ModuleConfig::struct_empty() const { if (user_consent_passengersRC.is_initialized()) { return false; } - if (country_consent_passengersRC.is_initialized()) { - return false; - } #endif // SDL_REMOTE_CONTROL return true; } @@ -828,10 +816,6 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const { user_consent_passengersRC.ReportErrors( &report__->ReportSubobject("user_consent_passengersRC")); } - if (!country_consent_passengersRC.is_valid()) { - country_consent_passengersRC.ReportErrors( - &report__->ReportSubobject("country_consent_passengersRC")); - } #endif // SDL_REMOTE_CONTROL const std::string validation_info = omitted_validation_info + PolicyTableTypeToString(GetPolicyTableType()); @@ -893,7 +877,6 @@ void ModuleConfig::SetPolicyTableType(PolicyTableType pt_type) { vehicle_year.SetPolicyTableType(pt_type); #ifdef SDL_REMOTE_CONTROL user_consent_passengersRC.SetPolicyTableType(pt_type); - country_consent_passengersRC.SetPolicyTableType(pt_type); #endif // SDL_REMOTE_CONTROL } diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc index 6b3acd44ec..e71eb2e220 100644 --- a/src/components/policy/policy_external/src/sql_pt_queries.cc +++ b/src/components/policy/policy_external/src/sql_pt_queries.cc @@ -77,8 +77,7 @@ const std::string kCreateSchema = " `vehicle_year` VARCHAR(4), " " `preloaded_date` VARCHAR (10), " " `certificate` VARCHAR (45), " - " `user_consent_passengersRC` BOOL, " - " `country_consent_passengersRC` BOOL " + " `user_consent_passengersRC` BOOL " "); " "CREATE TABLE IF NOT EXISTS `functional_group`( " " `id` INTEGER PRIMARY KEY NOT NULL, " @@ -742,8 +741,7 @@ const std::string kUpdateModuleConfig = " `exchange_after_x_kilometers` = ?, `exchange_after_x_days` = ?, " " `timeout_after_x_seconds` = ?, `vehicle_make` = ?, " " `vehicle_model` = ?, `vehicle_year` = ?, `preloaded_date` = ?, " - "`certificate` = ?, `user_consent_passengersRC` = ?, " - "`country_consent_passengersRC` = ?"; + "`certificate` = ?, `user_consent_passengersRC` = ? "; const std::string kInsertEndpoint = "INSERT INTO `endpoint` (`service`, `url`, `application_id`) " @@ -795,7 +793,7 @@ const std::string kSelectModuleConfig = " `exchange_after_x_kilometers`, `exchange_after_x_days`, " " `timeout_after_x_seconds`, `vehicle_make`," " `vehicle_model`, `vehicle_year`, `preloaded_date`, `certificate`, " - " `user_consent_passengersRC` , `country_consent_passengersRC` " + " `user_consent_passengersRC` " " FROM `module_config`"; const std::string kSelectEndpoints = diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc index 1960fb6e03..5a67028d5f 100644 --- a/src/components/policy/policy_external/src/sql_pt_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_representation.cc @@ -555,8 +555,6 @@ void SQLPTRepresentation::GatherModuleConfig( #ifdef SDL_REMOTE_CONTROL *config->user_consent_passengersRC = query.IsNull(8) ? true : query.GetBoolean(10); - *config->country_consent_passengersRC = - query.IsNull(9) ? true : query.GetBoolean(11); #endif // SDL_REMOTE_CONTROL } @@ -1256,9 +1254,6 @@ bool SQLPTRepresentation::SaveModuleConfig( config.user_consent_passengersRC.is_initialized() ? query.Bind(10, *(config.user_consent_passengersRC)) : query.Bind(10); - config.country_consent_passengersRC.is_initialized() - ? query.Bind(11, *(config.country_consent_passengersRC)) - : query.Bind(11); #endif // SDL_REMOTE_CONTROL if (!query.Exec()) { |