summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Byzhynar <abyzhynar@luxoft.com>2018-05-30 10:14:17 -0400
committerAndriy Byzhynar <abyzhynar@luxoft.com>2018-05-30 10:14:17 -0400
commit1a192a50287da61c6aa6191fc244143f568e048a (patch)
tree81b8e40a78ec3f45ea10b25a10af7a30d1db08e5
parent0637cd4cdc159ef60061094cf67ab9598a45d70b (diff)
downloadsdl_core-1a192a50287da61c6aa6191fc244143f568e048a.tar.gz
Remove redundant enum and update logic accordingly
-rw-r--r--src/components/policy/policy_external/include/policy/policy_types.h3
-rw-r--r--src/components/policy/policy_external/src/policy_helper.cc28
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_helper.h3
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_types.h3
-rw-r--r--src/components/policy/policy_regular/src/policy_helper.cc23
5 files changed, 10 insertions, 50 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 5dc6bd0711..9682b3d58d 100644
--- a/src/components/policy/policy_external/include/policy/policy_types.h
+++ b/src/components/policy/policy_external/include/policy/policy_types.h
@@ -507,8 +507,7 @@ enum PermissionsCheckResult {
RESULT_CONSENT_NOT_REQIURED,
RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED,
RESULT_REQUEST_TYPE_CHANGED,
- RESULT_REQUEST_SUBTYPE_CHANGED,
- RESULT_REQUEST_TYPE_AND_SUBTYPE_CHANGED
+ RESULT_REQUEST_SUBTYPE_CHANGED
};
/**
diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc
index 90d61320ad..39b9399c24 100644
--- a/src/components/policy/policy_external/src/policy_helper.cc
+++ b/src/components/policy/policy_external/src/policy_helper.cc
@@ -325,20 +325,13 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
if (!IsPredefinedApp(app_policy)) {
const bool is_request_type_changed = IsRequestTypeChanged(app_policy);
const bool is_request_subtype_changed = IsRequestSubTypeChanged(app_policy);
- if (is_request_type_changed && is_request_subtype_changed) {
- LOG4CXX_TRACE(
- logger_,
- "Both request types & subtypes were changed for application: "
- << app_id);
- SetPendingPermissions(app_policy,
- RESULT_REQUEST_TYPE_AND_SUBTYPE_CHANGED);
- AddResult(app_id, RESULT_REQUEST_TYPE_AND_SUBTYPE_CHANGED);
- } else if (is_request_type_changed) {
+ if (is_request_type_changed) {
LOG4CXX_TRACE(logger_,
"Request types were changed for application: " << app_id);
SetPendingPermissions(app_policy, RESULT_REQUEST_TYPE_CHANGED);
AddResult(app_id, RESULT_REQUEST_TYPE_CHANGED);
- } else if (is_request_subtype_changed) {
+ }
+ if (is_request_subtype_changed) {
LOG4CXX_TRACE(
logger_, "Request subtypes were changed for application: " << app_id);
SetPendingPermissions(app_policy, RESULT_REQUEST_SUBTYPE_CHANGED);
@@ -421,20 +414,6 @@ void policy::CheckAppPolicy::SetPendingPermissions(
permissions_diff.requestSubType.push_back(request_subtype);
}
break;
- case RESULT_REQUEST_TYPE_AND_SUBTYPE_CHANGED:
- permissions_diff.requestTypeChanged = true;
- permissions_diff.requestSubTypeChanged = true;
-
- // Getting Request Types from PTU (not from cache)
- for (const auto& request_type : *app_policy.second.RequestType) {
- permissions_diff.requestType.push_back(EnumToJsonString(request_type));
- }
-
- // Getting Request SubTypes from PTU (not from cache)
- for (const auto& request_subtype : *app_policy.second.RequestSubType) {
- permissions_diff.requestSubType.push_back(request_subtype);
- }
- break;
default:
return;
}
@@ -571,7 +550,6 @@ void FillActionsForAppPolicies::operator()(
case RESULT_PERMISSIONS_REVOKED:
case RESULT_REQUEST_TYPE_CHANGED:
case RESULT_REQUEST_SUBTYPE_CHANGED:
- case RESULT_REQUEST_TYPE_AND_SUBTYPE_CHANGED:
break;
case RESULT_NO_CHANGES:
default:
diff --git a/src/components/policy/policy_regular/include/policy/policy_helper.h b/src/components/policy/policy_regular/include/policy/policy_helper.h
index debfff68ae..7f27ab2676 100644
--- a/src/components/policy/policy_regular/include/policy/policy_helper.h
+++ b/src/components/policy/policy_regular/include/policy/policy_helper.h
@@ -96,8 +96,7 @@ struct CheckAppPolicy {
RESULT_CONSENT_NOT_REQIURED,
RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED,
RESULT_REQUEST_TYPE_CHANGED,
- RESULT_REQUEST_SUBTYPE_CHANGED,
- RESULT_REQUEST_TYPE_AND_SUBTYPE_CHANGED
+ RESULT_REQUEST_SUBTYPE_CHANGED
};
void SetPendingPermissions(const AppPoliciesValueType& app_policy,
diff --git a/src/components/policy/policy_regular/include/policy/policy_types.h b/src/components/policy/policy_regular/include/policy/policy_types.h
index b30baa5955..e0fc808e2f 100644
--- a/src/components/policy/policy_regular/include/policy/policy_types.h
+++ b/src/components/policy/policy_regular/include/policy/policy_types.h
@@ -474,7 +474,8 @@ enum PermissionsCheckResult {
RESULT_CONSENT_NEEDED,
RESULT_CONSENT_NOT_REQIURED,
RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED,
- RESULT_REQUEST_TYPE_CHANGED
+ RESULT_REQUEST_TYPE_CHANGED,
+ RESULT_REQUEST_SUBTYPE_CHANGED
};
/**
diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc
index c408aa4325..796dd25ec4 100644
--- a/src/components/policy/policy_regular/src/policy_helper.cc
+++ b/src/components/policy/policy_regular/src/policy_helper.cc
@@ -343,12 +343,10 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
const bool is_request_type_changed = IsRequestTypeChanged(app_policy);
const bool is_request_subtype_changed = IsRequestSubTypeChanged(app_policy);
- if (is_request_type_changed && is_request_subtype_changed) {
- SetPendingPermissions(app_policy,
- RESULT_REQUEST_TYPE_AND_SUBTYPE_CHANGED);
- } else if (is_request_type_changed) {
+ if (is_request_type_changed) {
SetPendingPermissions(app_policy, RESULT_REQUEST_TYPE_CHANGED);
- } else if (is_request_subtype_changed) {
+ }
+ if (is_request_subtype_changed) {
SetPendingPermissions(app_policy, RESULT_REQUEST_SUBTYPE_CHANGED);
}
@@ -422,21 +420,6 @@ void policy::CheckAppPolicy::SetPendingPermissions(
permissions_diff.appRevokedPermissions = GetRevokedGroups(app_policy);
RemoveRevokedConsents(app_policy, permissions_diff.appRevokedPermissions);
break;
- case RESULT_REQUEST_TYPE_AND_SUBTYPE_CHANGED:
- permissions_diff.priority.clear();
- permissions_diff.requestTypeChanged = true;
- permissions_diff.requestSubTypeChanged = true;
-
- // Getting Request Types from PTU (not from cache)
- for (const auto& request_type : *app_policy.second.RequestType) {
- permissions_diff.requestType.push_back(EnumToJsonString(request_type));
- }
-
- // Getting Request SubTypes from PTU (not from cache)
- for (const auto& request_subtype : *app_policy.second.RequestSubType) {
- permissions_diff.requestSubType.push_back(request_subtype);
- }
- break;
case RESULT_REQUEST_TYPE_CHANGED:
permissions_diff.priority.clear();
permissions_diff.requestTypeChanged = true;