summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2018-03-29 10:14:42 -0400
committerGitHub <noreply@github.com>2018-03-29 10:14:42 -0400
commit95cd0fc678768e9fc9e977bdb1026e896397e0df (patch)
treec5f8abd65fccb8b2d6221f3cef791d587de26ce4
parent93270f97dfcc365c5a1a954b21114d4ed1d34ea1 (diff)
parent05c8960c2d8683e4aadecb4a7705b1faf6aca378 (diff)
downloadsdl_core-95cd0fc678768e9fc9e977bdb1026e896397e0df.tar.gz
Merge pull request #2086 from LuxoftAKutsan/fix/on_permission_change_after_app_permission_consent
Fix/on permission change after app permission consent
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc1
-rw-r--r--src/components/policy/policy_external/src/policy_helper.cc6
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc44
-rw-r--r--src/components/policy/policy_regular/src/policy_helper.cc6
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc2
5 files changed, 24 insertions, 35 deletions
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 306e9782f5..0270f23144 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -2409,6 +2409,7 @@ void MessageHelper::SendOnPermissionsChangeNotification(
uint32_t connection_key,
const policy::Permissions& permissions,
ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject content(smart_objects::SmartType_Map);
content[strings::params][strings::function_id] =
diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc
index 5425777833..8be0372c03 100644
--- a/src/components/policy/policy_external/src/policy_helper.cc
+++ b/src/components/policy/policy_external/src/policy_helper.cc
@@ -797,7 +797,7 @@ void FillFunctionalGroupPermissions(
FunctionalGroupNames& names,
GroupConsent state,
std::vector<FunctionalGroupPermission>& permissions) {
- LOG4CXX_INFO(logger_, "FillFunctionalGroupPermissions");
+ LOG4CXX_AUTO_TRACE(logger_);
FunctionalGroupIDs::const_iterator it = ids.begin();
FunctionalGroupIDs::const_iterator it_end = ids.end();
for (; it != it_end; ++it) {
@@ -817,7 +817,7 @@ bool IsPredefinedApp(const AppPoliciesValueType& app) {
FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from,
const FunctionalGroupIDs& what) {
- LOG4CXX_INFO(logger_, "Exclude same groups");
+ LOG4CXX_AUTO_TRACE(logger_);
FunctionalGroupIDs from_copy(from);
FunctionalGroupIDs what_copy(what);
@@ -839,7 +839,7 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from,
FunctionalGroupIDs Merge(const FunctionalGroupIDs& first,
const FunctionalGroupIDs& second) {
- LOG4CXX_INFO(logger_, "Merge groups");
+ LOG4CXX_AUTO_TRACE(logger_);
FunctionalGroupIDs first_copy(first);
FunctionalGroupIDs second_copy(second);
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..2cd0d2b23b 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -588,13 +588,8 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id,
policy_table::FunctionalGroupings functional_groupings;
cache_->GetFunctionalGroupings(functional_groupings);
-#ifdef SDL_REMOTE_CONTROL
- ApplicationOnDevice who = {device_id, app_id};
- const policy_table::Strings app_groups = access_remote_->GetGroups(who);
-#else // SDL_REMOTE_CONTROL
- const policy_table::Strings app_groups =
+ policy_table::Strings app_groups =
GetGroupsNames(app_group_permissions);
-#endif // SDL_REMOTE_CONTROL
// Undefined groups (without user consent) disallowed by default, since
// OnPermissionsChange notification has no "undefined" section
@@ -614,8 +609,20 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id,
<< " returns true");
}
+ if (cache_->IsApplicationRevoked(app_id)) {
+ // SDL must be able to notify mobile side with its status after app has
+ // been revoked by backend
+ if ("OnHMIStatus" == rpc && "NONE" == hmi_level) {
+ result.hmi_level_permitted = kRpcAllowed;
+ } else {
+ result.hmi_level_permitted = kRpcDisallowed;
+ }
+ return;
+ }
+
const bool known_rpc = rpc_permissions.end() != rpc_permissions.find(rpc);
- LOG4CXX_INFO(logger_, "Is known rpc " << known_rpc);
+ LOG4CXX_DEBUG(logger_, "Is known rpc " <<
+ (known_rpc ? "true" : "false") );
if (!known_rpc) {
// RPC not found in list == disallowed by backend
result.hmi_level_permitted = kRpcDisallowed;
@@ -637,6 +644,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id,
rpc_permissions[rpc].hmi_permissions[kUserDisallowedKey].find(
hmi_level)) {
// RPC found in allowed == allowed by backend, but disallowed by user
+ LOG4CXX_DEBUG(logger_, "RPC found in allowed == allowed by backend, but disallowed by user");
result.hmi_level_permitted = kRpcUserDisallowed;
} else {
LOG4CXX_DEBUG(logger_,
@@ -715,17 +723,6 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id,
LOG4CXX_DEBUG(logger_, "There are no parameters allowed.");
result.hmi_level_permitted = kRpcDisallowed;
}
-
- if (cache_->IsApplicationRevoked(app_id)) {
- // SDL must be able to notify mobile side with its status after app has
- // been revoked by backend
- if ("OnHMIStatus" == rpc && "NONE" == hmi_level) {
- result.hmi_level_permitted = kRpcAllowed;
- } else {
- result.hmi_level_permitted = kRpcDisallowed;
- }
- return;
- }
}
bool PolicyManagerImpl::ResetUserConsent() {
@@ -967,6 +964,7 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges(
void PolicyManagerImpl::NotifyPermissionsChanges(
const std::string& policy_app_id,
const std::vector<FunctionalGroupPermission>& app_group_permissions) {
+ LOG4CXX_AUTO_TRACE(logger_);
// Get current functional groups from DB with RPC permissions
policy_table::FunctionalGroupings functional_groups;
cache_->GetFunctionalGroupings(functional_groups);
@@ -986,10 +984,6 @@ void PolicyManagerImpl::SetUserConsentForApp(
const PermissionConsent& permissions, const NotificationMode mode) {
LOG4CXX_AUTO_TRACE(logger_);
- if (permissions.group_permissions.empty()) {
- LOG4CXX_DEBUG(logger_, "Permissions list is empty, skipping update.");
- return;
- }
cache_->ResetCalculatedPermissions();
PermissionConsent verified_permissions =
@@ -1157,14 +1151,8 @@ void PolicyManagerImpl::GetPermissionsForApp(
FunctionalIdType group_types;
-#ifdef SDL_REMOTE_CONTROL
- allowed_by_default = false;
- const bool ret = access_remote_->GetPermissionsForApp(
- device_id, app_id_to_check, group_types);
-#else
const bool ret =
cache_->GetPermissionsForApp(device_id, app_id_to_check, group_types);
-#endif // REMOTE_CONTROL
if (!ret) {
LOG4CXX_WARN(logger_,
diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc
index 782a65f91a..95f275769c 100644
--- a/src/components/policy/policy_regular/src/policy_helper.cc
+++ b/src/components/policy/policy_regular/src/policy_helper.cc
@@ -709,7 +709,7 @@ void FillFunctionalGroupPermissions(
FunctionalGroupNames& names,
GroupConsent state,
std::vector<FunctionalGroupPermission>& permissions) {
- LOG4CXX_INFO(logger_, "FillFunctionalGroupPermissions");
+ LOG4CXX_AUTO_TRACE(logger_);
FunctionalGroupIDs::const_iterator it = ids.begin();
FunctionalGroupIDs::const_iterator it_end = ids.end();
for (; it != it_end; ++it) {
@@ -729,7 +729,7 @@ bool IsPredefinedApp(const AppPoliciesValueType& app) {
FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from,
const FunctionalGroupIDs& what) {
- LOG4CXX_INFO(logger_, "Exclude same groups");
+ LOG4CXX_AUTO_TRACE(logger_);
FunctionalGroupIDs from_copy(from);
FunctionalGroupIDs what_copy(what);
@@ -751,7 +751,7 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from,
FunctionalGroupIDs Merge(const FunctionalGroupIDs& first,
const FunctionalGroupIDs& second) {
- LOG4CXX_INFO(logger_, "Merge groups");
+ LOG4CXX_AUTO_TRACE(logger_);
FunctionalGroupIDs first_copy(first);
FunctionalGroupIDs second_copy(second);
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index 055b57d985..39b303cbb5 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -754,7 +754,7 @@ void PolicyManagerImpl::GetPermissionsForApp(
std::string& PolicyManagerImpl::GetCurrentDeviceId(
const std::string& policy_app_id) const {
- LOG4CXX_INFO(logger_, "GetDeviceInfo");
+ LOG4CXX_AUTO_TRACE(logger_);
last_device_id_ = listener()->OnCurrentDeviceIdUpdateRequired(policy_app_id);
return last_device_id_;
}