diff options
author | Maksym Ked (GitHub) <41471947+mked-luxoft@users.noreply.github.com> | 2019-08-29 17:18:03 +0300 |
---|---|---|
committer | JackLivio <jack@livio.io> | 2019-08-29 10:18:03 -0400 |
commit | 5905717229c512e975ca95715736db795f3105d2 (patch) | |
tree | eaf7ebfed69c51f82941c0c095a0117e62073d18 /src/components/policy/policy_regular/include/policy/policy_manager_impl.h | |
parent | 0d41f149005218b9e5d76f6e40b892ecbc2e4280 (diff) | |
download | sdl_core-5905717229c512e975ca95715736db795f3105d2.tar.gz |
Feature/rpc message protection (#2951)
* Added encryption required flag to policy table.
Also added RPC Encryption Manager Interface for comfortable access to
policy table.
* Added logic for processing RPC according to the proposal.
* The permission change notification has been expanded.
* Fixed UTs after implementation feature RPC message protection.
* Fix multiframe issue
* Fix style
* Added storage of encryption required rpcs
* Fix CI build
* Extended logic adding encryption flag in message helper
* Added permission check of encryption required for PROP
* Added permission check of encryption required for EXT
* Fixes after rebase
* Answer PR comments
- fixed typos
- fixed 3rd party cmake
* fixup! Added logic for processing RPC according to the proposal.
* fixup! The permission change notification has been expanded.
* Answer PR comments
- renamed functions
- added encryption_required flag to sql_pt_ext* source files
- added condition and logging to CacheManager::GetApplicationParams
* fixup! Added logic for processing RPC according to the proposal.
* fixup! Added encryption required flag to policy table.
* fixup! Added permission check of encryption required for EXT
* fixup! Added permission check of encryption required for PROP
* Fixes after rebase
Diffstat (limited to 'src/components/policy/policy_regular/include/policy/policy_manager_impl.h')
-rw-r--r-- | src/components/policy/policy_regular/include/policy/policy_manager_impl.h | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h index 903f7820d2..d8ab079cf0 100644 --- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h @@ -37,6 +37,7 @@ #include <list> #include <string> +#include "application_manager/policies/policy_encryption_flag_getter.h" #include "policy/access_remote.h" #include "policy/access_remote_impl.h" #include "policy/cache_manager_interface.h" @@ -57,6 +58,45 @@ struct CheckAppPolicy; class PolicyManagerImpl : public PolicyManager { public: PolicyManagerImpl(); + /* + * \param policy_app_id policy app id + * \return true if the app need encryption + */ + bool AppNeedEncryption(const std::string& policy_app_id) const OVERRIDE; + + /* + * \param policy_app_id policy app id + * \return Optional app need encryption + */ + const rpc::Optional<rpc::Boolean> GetAppEncryptionRequired( + const std::string& policy_app_id) const OVERRIDE; + /* + * \param policy_app_id policy app id + * \return groups that exist for app + */ + const std::vector<std::string> GetFunctionalGroupsForApp( + const std::string& policy_app_id) const OVERRIDE; + + const std::vector<std::string> GetApplicationPolicyIDs() const OVERRIDE; + + /* + * \param policy_group group + * \return true if the group need encryption + */ + bool FunctionGroupNeedEncryption( + const std::string& policy_group) const OVERRIDE; + /* + * \param policy_group group + * \return RPCs that exists in group + */ + const std::vector<std::string> GetRPCsForFunctionGroup( + const std::string& group) const OVERRIDE; + /* + * \param function_id function id + * \return policy function name + */ + const std::string GetPolicyFunctionName( + const uint32_t function_id) const OVERRIDE; /** * @brief set_listener set new policy listener instance @@ -92,6 +132,21 @@ class PolicyManagerImpl : public PolicyManager { bool LoadPT(const std::string& file, const BinaryMessage& pt_content) OVERRIDE; + typedef policy_table::ApplicationPolicies::value_type AppPoliciesValueType; + + /** + * @brief Notifies system by sending OnAppPermissionChanged notification + * @param app_policy Reference to application policy + */ + void NotifySystem(const AppPoliciesValueType& app_policy) const; + + /** + * @brief Sends OnPermissionChange notification to application if its + * currently registered + * @param app_policy Reference to application policy + */ + void SendPermissionsToApp(const AppPoliciesValueType& app_policy); + /** * @brief Resets Policy Table * @param file_name Path to preloaded PT file @@ -836,10 +891,19 @@ class PolicyManagerImpl : public PolicyManager { * @param snapshot Shared pointer to current copy of policy table * @return Collection per-application results */ - void CheckPermissionsChanges( + CheckAppPolicyResults CheckPermissionsChanges( const std::shared_ptr<policy_table::Table> update, const std::shared_ptr<policy_table::Table> snapshot); + void ProcessAppPolicyCheckResults( + const CheckAppPolicyResults& results, + const rpc::policy_table_interface_base::ApplicationPolicies& + app_policies); + + void ProcessActionsForAppPolicies( + const ApplicationsPoliciesActions& actions, + const policy_table::ApplicationPolicies& app_policies); + /** * @brief Compares current policies to the updated one. * Trigger actions in case if certain fields after update were changed. |