summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKramchaninov Pavel <pkramchaninov@luxoft.com>2015-04-23 17:34:59 +0300
committerKramchaninov Pavel <pkramchaninov@luxoft.com>2015-04-23 17:34:59 +0300
commit375ed7e0549adedfc72564a5fd0b4ffe9c39cea6 (patch)
tree39c680b7d1f2bf0481b35c19d586b7e5540b2aaf
parentfc59ad753792944a46b437b14d9da0c89c1cf417 (diff)
parent309f5b2a75e1261685b51c382de57e28130d7a24 (diff)
downloadsdl_core-375ed7e0549adedfc72564a5fd0b4ffe9c39cea6.tar.gz
Merge pull request #92 from LuxoftSDL/Revoked_groups_handling_fixes4.0.0-RC2
Revoked groups handling fixes
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc4
-rw-r--r--src/components/policy/src/policy/src/policy_helper.cc14
-rw-r--r--src/components/policy/src/policy/src/policy_manager_impl.cc13
3 files changed, 24 insertions, 7 deletions
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index d3d13f0af4..bfef1c8f77 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -685,8 +685,10 @@ void PolicyHandler::OnPendingPermissionChange(
SendOnAppPermissionsChangedNotification(app->app_id(), permissions);
policy_manager_->RemovePendingPermissionChanges(policy_app_id);
+ // "Break" statement has to be here to continue processing in case of
+ // there is another "true" flag in permissions struct
+ break;
}
- break;
}
case mobile_apis::HMILevel::eType::HMI_BACKGROUND: {
if (permissions.isAppPermissionsRevoked) {
diff --git a/src/components/policy/src/policy/src/policy_helper.cc b/src/components/policy/src/policy/src/policy_helper.cc
index 2677e5789c..5a4682bbcf 100644
--- a/src/components/policy/src/policy/src/policy_helper.cc
+++ b/src/components/policy/src/policy/src/policy_helper.cc
@@ -76,8 +76,9 @@ bool operator()(const policy::StringsValueType& value) {
checker);
if (groups_attributes_.end() == it) {
return false;
- }
+ }
FunctionalGroupPermission group;
+ group.group_name = it->second.second;
group.group_alias = it->second.first;
group.group_id = it->first;
groups_permissions_.push_back(group);
@@ -152,6 +153,17 @@ bool policy::CheckAppPolicy::HasRevokedGroups(
it_groups_new, it_groups_new_end,
std::back_inserter(revoked_group_list), Compare);
+ // Remove groups which are not required user consent
+ policy_table::Strings::iterator it_revoked = revoked_group_list.begin();
+ for (;revoked_group_list.end() != it_revoked; ) {
+ if (!IsConsentRequired(app_policy.first, std::string(*it_revoked))) {
+ revoked_group_list.erase(it_revoked);
+ it_revoked = revoked_group_list.begin();
+ } else {
+ ++it_revoked;
+ }
+ }
+
if (revoked_groups) {
*revoked_groups = revoked_group_list;
}
diff --git a/src/components/policy/src/policy/src/policy_manager_impl.cc b/src/components/policy/src/policy/src/policy_manager_impl.cc
index 28e737ac69..955dbf1261 100644
--- a/src/components/policy/src/policy/src/policy_manager_impl.cc
+++ b/src/components/policy/src/policy/src/policy_manager_impl.cc
@@ -127,6 +127,13 @@ bool PolicyManagerImpl::LoadPT(const std::string& file,
return false;
}
+ // Checking of difference between PTU and current policy state
+ // Must to be done before PTU applying since it is possible, that functional
+ // groups, which had been present before are absent in PTU and will be
+ // removed after update. So in case of revoked groups system has to know
+ // names and ids of revoked groups before they will be removed.
+ CheckPermissionsChanges(pt_update, policy_table_snapshot);
+
// Replace current data with updated
if (!cache_->ApplyUpdate(*pt_update)) {
LOG4CXX_WARN(logger_, "Unsuccessful save of updated policy table.");
@@ -137,16 +144,12 @@ bool PolicyManagerImpl::LoadPT(const std::string& file,
listener_->OnCertificateUpdated(*(pt_update->policy_table.module_config.certificate));
}
-
- // Check permissions for applications, send notifications
- CheckPermissionsChanges(pt_update, policy_table_snapshot);
-
std::map<std::string, StringArray> app_hmi_types;
cache_->GetHMIAppTypeAfterUpdate(app_hmi_types);
if (!app_hmi_types.empty()) {
LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType");
listener_->OnUpdateHMIAppType(app_hmi_types);
- }else{
+ } else {
LOG4CXX_INFO(logger_, "app_hmi_types empty" << pt_content.size());
}