diff options
Diffstat (limited to 'src/components/policy/policy_external/src/policy_manager_impl.cc')
-rw-r--r-- | src/components/policy/policy_external/src/policy_manager_impl.cc | 59 |
1 files changed, 34 insertions, 25 deletions
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 787e65f43a..cd2bd4c2d4 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -622,6 +622,10 @@ void PolicyManagerImpl::ProcessActionsForAppPolicies( continue; } + if (action.second.app_properties_changed) { + app_properties_changed_list_.push_back(app_policy->first); + } + const auto devices_ids = listener()->GetDevicesIds(app_policy->first); for (const auto& device_id : devices_ids) { if (action.second.is_consent_needed) { @@ -820,21 +824,13 @@ void PolicyManagerImpl::GetEnabledCloudApps( cache_->GetEnabledCloudApps(enabled_apps); } -bool PolicyManagerImpl::GetCloudAppParameters( - const std::string& policy_app_id, - bool& enabled, - std::string& endpoint, - std::string& certificate, - std::string& auth_token, - std::string& cloud_transport_type, - std::string& hybrid_app_preference) const { - return cache_->GetCloudAppParameters(policy_app_id, - enabled, - endpoint, - certificate, - auth_token, - cloud_transport_type, - hybrid_app_preference); +std::vector<std::string> PolicyManagerImpl::GetEnabledLocalApps() const { + return cache_->GetEnabledLocalApps(); +} + +bool PolicyManagerImpl::GetAppProperties( + const std::string& policy_app_id, AppProperties& out_app_properties) const { + return cache_->GetAppProperties(policy_app_id, out_app_properties); } void PolicyManagerImpl::InitCloudApp(const std::string& policy_app_id) { @@ -1201,6 +1197,12 @@ void PolicyManagerImpl::AddDevice(const std::string& device_id, } } +void PolicyManagerImpl::OnLocalAppAdded() { + LOG4CXX_AUTO_TRACE(logger_); + update_status_manager_.ScheduleUpdate(); + StartPTExchange(); +} + void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id, const DeviceInfo& device_info) { LOG4CXX_AUTO_TRACE(logger_); @@ -1702,6 +1704,12 @@ void PolicyManagerImpl::UpdateAppConsentWithExternalConsent( cache_->SetExternalConsentForApp(updated_external_consent_permissions); } +void PolicyManagerImpl::SendOnAppPropertiesChangeNotification( + const std::string& policy_app_id) const { + LOG4CXX_AUTO_TRACE(logger_); + listener_->SendOnAppPropertiesChangeNotification(policy_app_id); +} + void PolicyManagerImpl::ResumePendingAppPolicyActions() { LOG4CXX_AUTO_TRACE(logger_); @@ -1714,6 +1722,10 @@ void PolicyManagerImpl::ResumePendingAppPolicyActions() { SendPermissionsToApp(send_permissions_params.first, send_permissions_params.second); } + + for (auto& app : app_properties_changed_list_) { + SendOnAppPropertiesChangeNotification(app); + } send_permissions_list_.clear(); } @@ -2318,10 +2330,10 @@ bool PolicyManagerImpl::InitPT(const std::string& file_name, const bool ret = cache_->Init(file_name, settings); if (ret) { RefreshRetrySequence(); - std::vector<std::string> enabled_apps; - cache_->GetEnabledCloudApps(enabled_apps); - for (auto it = enabled_apps.begin(); it != enabled_apps.end(); ++it) { - SendAuthTokenUpdated(*it); + std::vector<std::string> enabled_cloud_apps; + cache_->GetEnabledCloudApps(enabled_cloud_apps); + for (auto app : enabled_cloud_apps) { + SendAuthTokenUpdated(app); } } return ret; @@ -2440,12 +2452,9 @@ void PolicyManagerImpl::SendAppPermissionsChanged( } void PolicyManagerImpl::SendAuthTokenUpdated(const std::string policy_app_id) { - bool enabled = false; - std::string end, cert, ctt, hap; - std::string auth_token; - cache_->GetCloudAppParameters( - policy_app_id, enabled, end, cert, auth_token, ctt, hap); - listener_->OnAuthTokenUpdated(policy_app_id, auth_token); + AppProperties app_properties; + cache_->GetAppProperties(policy_app_id, app_properties); + listener_->OnAuthTokenUpdated(policy_app_id, app_properties.auth_token); } void PolicyManagerImpl::OnPrimaryGroupsChanged( |