From bfdcdd0f21dc83ffb8a607060d3392cad10406a4 Mon Sep 17 00:00:00 2001 From: AKalinich-Luxoft Date: Tue, 26 Sep 2017 15:00:32 +0300 Subject: Fix PTU applying for default app policy section There was a problem with applying changes for applications which is registered with "default" policies and this policy group was updated after PTU. In this case permissions for already registered applications which is using these groups still have permissions as before update. Also default policy section was not updated after PTU with changes in this section. This issue is reproduced on EXTERNAL_PROPRIETARY flow only. To fix this issue there was removed code in CacheManager, which incorrectly assigns default policies to apps with "default" policies. Also there was a redundant code because default policies is unwrapped in PTU before its applying, so all specific application policies is already have actual new default policy permissions. In this case it is correct to assign to every app his own policies from PTU. Also there was updated logic in ProcessAppPolicyCheckResults() to perform all needed actions once per app, because its possible that results could contain sever results for one app_id. --- .../policy/policy_external/src/policy_helper.cc | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/components/policy/policy_external/src/policy_helper.cc') diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc index 3041323489..5425777833 100644 --- a/src/components/policy/policy_external/src/policy_helper.cc +++ b/src/components/policy/policy_external/src/policy_helper.cc @@ -484,6 +484,41 @@ bool CheckAppPolicy::IsRequestTypeChanged( return diff.size(); } +void FillActionsForAppPolicies::operator()( + const policy::CheckAppPolicyResults::value_type& value) { + const std::string app_id = value.first; + const policy_table::ApplicationPolicies::const_iterator app_policy = + app_policies_.find(app_id); + + if (app_policies_.end() == app_policy) { + return; + } + + if (IsPredefinedApp(*app_policy)) { + return; + } + + switch (value.second) { + case RESULT_APP_REVOKED: + case RESULT_NICKNAME_MISMATCH: + actions_[app_id].is_notify_system = true; + return; + case RESULT_CONSENT_NEEDED: + case RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED: + actions_[app_id].is_consent_needed = true; + break; + case RESULT_CONSENT_NOT_REQIURED: + case RESULT_PERMISSIONS_REVOKED: + case RESULT_REQUEST_TYPE_CHANGED: + break; + case RESULT_NO_CHANGES: + default: + return; + } + actions_[app_id].is_notify_system = true; + actions_[app_id].is_send_permissions_to_app = true; +} + FillNotificationData::FillNotificationData(Permissions& data, GroupConsent group_state, GroupConsent undefined_group_consent, -- cgit v1.2.1