Skip to content

Commit

Permalink
Merge pull request #2676 from LuxoftAKutsan/fix/fix_missing_module_ty…
Browse files Browse the repository at this point in the history
…pes_for_default_app

Load module types from referenced group for app_policies
  • Loading branch information
Jack-Byrne committed Oct 16, 2018
2 parents a79f044 + e7e56b2 commit 17c3f51
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 3,163 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 13 additions & 7 deletions src/components/policy/policy_external/src/sql_pt_representation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 0 additions & 2 deletions src/components/policy/policy_regular/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ target_link_libraries(UsageStatistics Utils)
set(EXCLUDE_PATHS
${POLICY_TABLE_PATHS}
${USAGE_STATISTICS_PATHS}
sql_pt_ext_queries.cc
sql_pt_ext_representation.cc
)

set(PATHS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <map>

#include "policy/pt_representation.h"
#include "policy/pt_ext_representation.h"
#include "policy/usage_statistics/statistics_manager.h"
#include "policy/cache_manager_interface.h"
#include "utils/threads/thread.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_H_

#include "policy/pt_representation.h"
#include "policy/pt_ext_representation.h"

namespace policy {

Expand Down
Loading

0 comments on commit 17c3f51

Please sign in to comment.