summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander <akutsan@luxoft.com>2018-10-15 20:04:04 +0000
committerAlexander <akutsan@luxoft.com>2018-10-15 23:52:44 +0300
commit9694a31e9090f6f6fc95a525e237956d7a66e33b (patch)
tree160fd7d4cf3924c20cdf983234bccb23d95127db
parent3f37ee5c1c1f3a97b98b6dc4bfb1a20444d3b8dd (diff)
downloadsdl_core-9694a31e9090f6f6fc95a525e237956d7a66e33b.tar.gz
Gather app_policies with right key for external
fixup! Gather app_policies with right key for external
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_representation.cc22
-rw-r--r--src/components/policy/policy_external/src/sql_pt_representation.cc20
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc3
3 files changed, 29 insertions, 16 deletions
diff --git a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
index 248372beff..a43b22a3b8 100644
--- a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
@@ -874,33 +874,39 @@ bool SQLPTExtRepresentation::GatherApplicationPoliciesSection(
*params.memory_kb = query.GetInteger(5);
*params.heart_beat_timeout_ms = query.GetUInteger(6);
- if (!GatherAppGroup(app_id, &params.groups)) {
+ const auto& gather_app_id = ((*policies).apps[app_id].is_string())
+ ? (*policies).apps[app_id].get_string()
+ : app_id;
+ // Data should be gathered from db by "default" key if application has
+ // default policies
+
+ if (!GatherAppGroup(gather_app_id, &params.groups)) {
return false;
}
bool denied = false;
- if (!GatherRemoteControlDenied(app_id, &denied)) {
+ if (!GatherRemoteControlDenied(gather_app_id, &denied)) {
return false;
}
if (!denied) {
- if (!GatherModuleType(app_id, &*params.moduleType)) {
+ if (!GatherModuleType(gather_app_id, &*params.moduleType)) {
return false;
}
}
- if (!GatherNickName(app_id, &*params.nicknames)) {
+ if (!GatherNickName(gather_app_id, &*params.nicknames)) {
return false;
}
- if (!GatherAppType(app_id, &*params.AppHMIType)) {
+ if (!GatherAppType(gather_app_id, &*params.AppHMIType)) {
return false;
}
- if (!GatherRequestType(app_id, &*params.RequestType)) {
+ if (!GatherRequestType(gather_app_id, &*params.RequestType)) {
return false;
}
- if (!GatherRequestSubType(app_id, &*params.RequestSubType)) {
+ if (!GatherRequestSubType(gather_app_id, &*params.RequestSubType)) {
return false;
}
- GatherPreconsentedGroup(app_id, &*params.preconsented_groups);
+ GatherPreconsentedGroup(gather_app_id, &*params.preconsented_groups);
(*policies).apps[app_id] = params;
}
return true;
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 31c69e3725..c8b367c8ec 100644
--- a/src/components/policy/policy_external/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_representation.cc
@@ -761,30 +761,36 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
*params.memory_kb = query.GetInteger(2);
*params.heart_beat_timeout_ms = query.GetUInteger(3);
- if (!GatherAppGroup(app_id, &params.groups)) {
+ const auto& gather_app_id = ((*policies).apps[app_id].is_string())
+ ? (*policies).apps[app_id].get_string()
+ : app_id;
+ // Data should be gathered from db by "default" key if application has
+ // default policies
+
+ if (!GatherAppGroup(gather_app_id, &params.groups)) {
return false;
}
bool denied = false;
- if (!GatherRemoteControlDenied(app_id, &denied)) {
+ if (!GatherRemoteControlDenied(gather_app_id, &denied)) {
return false;
}
if (!denied) {
- if (!GatherModuleType(app_id, &*params.moduleType)) {
+ if (!GatherModuleType(gather_app_id, &*params.moduleType)) {
return false;
}
}
- if (!GatherNickName(app_id, &*params.nicknames)) {
+ if (!GatherNickName(gather_app_id, &*params.nicknames)) {
return false;
}
- if (!GatherAppType(app_id, &*params.AppHMIType)) {
+ if (!GatherAppType(gather_app_id, &*params.AppHMIType)) {
return false;
}
- if (!GatherRequestType(app_id, &*params.RequestType)) {
+ if (!GatherRequestType(gather_app_id, &*params.RequestType)) {
return false;
}
- if (!GatherRequestSubType(app_id, &*params.RequestSubType)) {
+ if (!GatherRequestSubType(gather_app_id, &*params.RequestSubType)) {
return false;
}
diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc
index bb08dd185b..75f8be74eb 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -725,6 +725,8 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
const auto& gather_app_id = ((*policies).apps[app_id].is_string())
? (*policies).apps[app_id].get_string()
: app_id;
+ // Data should be gathered from db by "default" key if application has
+ // default policies
if (!GatherAppGroup(gather_app_id, &params.groups)) {
return false;
@@ -734,7 +736,6 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
return false;
}
if (!denied) {
- // Module types should be selected from db by referenced groups
if (!GatherModuleType(gather_app_id, &*params.moduleType)) {
return false;
}