From 4f12a8a308cd5ace6ffb64565a313a71a3fdabe6 Mon Sep 17 00:00:00 2001 From: AKalinich-Luxoft Date: Tue, 3 Oct 2017 11:48:18 +0300 Subject: Add new PermitResult values for EXTERNAL_PROPRIETARY flow Added new values for more detailed CheckPermissions result description. This values will be used in AM layer for generating info message string. --- .../policy/policy_external/include/policy/policy_types.h | 8 +++++++- src/components/policy/policy_external/src/cache_manager.cc | 1 + .../policy/policy_external/src/policy_manager_impl.cc | 12 ++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/components/policy/policy_external/include/policy/policy_types.h b/src/components/policy/policy_external/include/policy/policy_types.h index f57919b6f7..4055922a02 100644 --- a/src/components/policy/policy_external/include/policy/policy_types.h +++ b/src/components/policy/policy_external/include/policy/policy_types.h @@ -113,7 +113,13 @@ typedef std::vector PermissionsList; */ typedef std::vector StringArray; -enum PermitResult { kRpcAllowed = 0, kRpcDisallowed, kRpcUserDisallowed }; +enum PermitResult { + kRpcAllowed = 0, + kRpcDisallowed, + kRpcUserDisallowed, + kRpcAllParamsDisallowed, + kRpcAllParamsUserDisallowed +}; /** * @struct Stores result of check: diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc index a9b599f981..a9ba20aa29 100644 --- a/src/components/policy/policy_external/src/cache_manager.cc +++ b/src/components/policy/policy_external/src/cache_manager.cc @@ -1152,6 +1152,7 @@ void CacheManager::CheckPermissions(const PTString& app_id, policy_table::Strings::const_iterator app_groups_iter_end = pt_->policy_table.app_policies_section.apps[app_id].groups.end(); + result.hmi_level_permitted = PermitResult::kRpcDisallowed; policy_table::FunctionalGroupings::const_iterator concrete_group; for (; app_groups_iter != app_groups_iter_end; ++app_groups_iter) { 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 806b7e13ba..6a186f243b 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -665,7 +665,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id, .parameter_permissions.any_parameter_disallowed_by_user) { LOG4CXX_DEBUG(logger_, "All parameters are disallowed by user."); result.list_of_disallowed_params = rpc_params; - result.hmi_level_permitted = kRpcUserDisallowed; + result.hmi_level_permitted = kRpcAllParamsUserDisallowed; return; } @@ -673,7 +673,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id, .parameter_permissions.any_parameter_disallowed_by_policy) { LOG4CXX_DEBUG(logger_, "All parameters are disallowed by policy."); result.list_of_undefined_params = rpc_params; - result.hmi_level_permitted = kRpcDisallowed; + result.hmi_level_permitted = kRpcAllParamsDisallowed; return; } @@ -709,11 +709,11 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id, } if (result.DisallowedInclude(rpc_params)) { - LOG4CXX_DEBUG(logger_, "All parameters are disallowed."); - result.hmi_level_permitted = kRpcUserDisallowed; + LOG4CXX_DEBUG(logger_, "All parameters are disallowed by user."); + result.hmi_level_permitted = kRpcAllParamsUserDisallowed; } else if (!result.IsAnyAllowed(rpc_params)) { - LOG4CXX_DEBUG(logger_, "There are no parameters allowed."); - result.hmi_level_permitted = kRpcDisallowed; + LOG4CXX_DEBUG(logger_, "There are no parameters allowed by policy."); + result.hmi_level_permitted = kRpcAllParamsDisallowed; } if (cache_->IsApplicationRevoked(app_id)) { -- cgit v1.2.1