summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorAndrey Oleynik <aoleynik@luxoft.com>2017-08-21 13:54:39 +0300
committerAndrey Oleynik <aoleynik@luxoft.com>2017-08-21 16:02:16 +0300
commit08789ae20c7105cbac527c4b044fb2fff9284d07 (patch)
treeb2fc088e85a38d390d22f5c32c35b9e8de254cba /src/components
parent829b726b535638b33528fa3da5c593360300954d (diff)
downloadsdl_core-08789ae20c7105cbac527c4b044fb2fff9284d07.tar.gz
Removes unused interfaces from AccessRemote class
Diffstat (limited to 'src/components')
-rw-r--r--src/components/application_manager/include/application_manager/core_service.h10
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h12
-rw-r--r--src/components/application_manager/include/application_manager/service.h10
-rw-r--r--src/components/application_manager/src/core_service.cc14
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc8
-rw-r--r--src/components/application_manager/test/rc_policy_handler_test.cc11
-rw-r--r--src/components/functional_module/test/include/mock_service.h4
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h12
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h12
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h12
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h6
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h5
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h5
-rw-r--r--src/components/policy/policy_external/include/policy/access_remote.h41
-rw-r--r--src/components/policy/policy_external/include/policy/access_remote_impl.h7
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h8
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc34
-rw-r--r--src/components/policy/policy_regular/include/policy/access_remote.h40
-rw-r--r--src/components/policy/policy_regular/include/policy/access_remote_impl.h8
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h9
-rw-r--r--src/components/policy/policy_regular/src/access_remote_impl.cc47
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc34
-rw-r--r--src/components/policy/policy_regular/test/access_remote_impl_test.cc103
-rw-r--r--src/components/remote_control/src/commands/base_command_request.cc4
24 files changed, 4 insertions, 452 deletions
diff --git a/src/components/application_manager/include/application_manager/core_service.h b/src/components/application_manager/include/application_manager/core_service.h
index 29af7454b9..56d135efcb 100644
--- a/src/components/application_manager/include/application_manager/core_service.h
+++ b/src/components/application_manager/include/application_manager/core_service.h
@@ -89,16 +89,6 @@ class CoreService : public Service {
const std::string& module) FINAL;
/**
- * Sets access to functional group which contains given RPC for application
- * @param app_id id of application
- * @param module type
- * @param allowed true if driver has given access
- */
- void SetAccess(const ApplicationId& app_id,
- const std::string& module,
- bool allowed) FINAL;
-
- /**
* Checks if application has remote control functions
* @param app application
* @return true if application has remote control functions
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h
index bce7484fdf..f451c19813 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_handler.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h
@@ -163,18 +163,6 @@ class PolicyHandler : public PolicyHandlerInterface,
bool CheckModule(const PTString& app_id, const PTString& module) OVERRIDE;
/**
- * Sets access to equipment of vehicle for application by RPC
- * @param device_id unique identifier of device
- * @param app_id policy id application
- * @param module type
- * @param allowed true if access is allowed
- */
- void SetAccess(const PTString& device_id,
- const PTString& app_id,
- const PTString& module,
- bool allowed) OVERRIDE;
-
- /**
* @brief Notifies Remote apps about change in permissions
* @param device_id Device on which app is running
* @param application_id ID of app whose permissions are changed
diff --git a/src/components/application_manager/include/application_manager/service.h b/src/components/application_manager/include/application_manager/service.h
index a4eddc5447..be2570db3e 100644
--- a/src/components/application_manager/include/application_manager/service.h
+++ b/src/components/application_manager/include/application_manager/service.h
@@ -89,16 +89,6 @@ class Service {
const std::string& module) = 0;
/**
- * Sets access to functional group which contains given RPC for application
- * @param app_id id of application
- * @param module type
- * @param allowed true if driver has given access
- */
- virtual void SetAccess(const ApplicationId& app_id,
- const std::string& module,
- bool allowed) = 0;
-
- /**
* @brief Get pointer to application by application id
* @param app_id application id
* return pointer to application
diff --git a/src/components/application_manager/src/core_service.cc b/src/components/application_manager/src/core_service.cc
index 43a63b7d8d..4e41744e27 100644
--- a/src/components/application_manager/src/core_service.cc
+++ b/src/components/application_manager/src/core_service.cc
@@ -108,20 +108,6 @@ bool CoreService::CheckModule(const ApplicationId& app_id,
return false;
}
-void CoreService::SetAccess(const ApplicationId& app_id,
- const std::string& module,
- bool allowed) {
-#ifdef SDL_REMOTE_CONTROL
- ApplicationSharedPtr app = GetApplication(app_id);
- if (app) {
- std::string device_handle = MessageHelper::GetDeviceMacAddressForHandle(
- app->device(), application_manager_);
- application_manager_.GetPolicyHandler().SetAccess(
- device_handle, app->policy_app_id(), module, allowed);
- }
-#endif // SDL_REMOTE_CONTROL
-}
-
bool CoreService::IsRemoteControlApplication(ApplicationSharedPtr app) const {
#ifdef SDL_REMOTE_CONTROL
return application_manager_.GetPolicyHandler().CheckHMIType(
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 574f362e42..ae4fb033e9 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -2006,14 +2006,6 @@ bool PolicyHandler::CheckModule(const PTString& app_id,
return policy_manager_->CheckModule(app_id, module);
}
-void PolicyHandler::SetAccess(const PTString& device_id,
- const PTString& app_id,
- const PTString& module,
- bool allowed) {
- POLICY_LIB_CHECK_VOID();
- policy_manager_->SetAccess(device_id, app_id, module, allowed);
-}
-
void PolicyHandler::OnRemoteAppPermissionsChanged(
const std::string& device_id, const std::string& application_id) {
POLICY_LIB_CHECK_VOID();
diff --git a/src/components/application_manager/test/rc_policy_handler_test.cc b/src/components/application_manager/test/rc_policy_handler_test.cc
index 760500af95..efc3f5d46d 100644
--- a/src/components/application_manager/test/rc_policy_handler_test.cc
+++ b/src/components/application_manager/test/rc_policy_handler_test.cc
@@ -288,17 +288,6 @@ TEST_F(RCPolicyHandlerTest, CheckAccess_ValidParams_SUCCESS) {
policy_handler_.CheckAccess(kDeviceId_, kPolicyAppId_, module));
}
-TEST_F(RCPolicyHandlerTest, SetAccess_ValidParams_SUCCESS) {
- EnablePolicyAndPolicyManagerMock();
-
- const PTString module("module");
- const bool allowed(true);
- EXPECT_CALL(*mock_policy_manager_,
- SetAccess(kDeviceId_, kPolicyAppId_, module, allowed));
-
- policy_handler_.SetAccess(kDeviceId_, kPolicyAppId_, module, allowed);
-}
-
TEST_F(RCPolicyHandlerTest, CheckModule_SUCCESS) {
EnablePolicyAndPolicyManagerMock();
diff --git a/src/components/functional_module/test/include/mock_service.h b/src/components/functional_module/test/include/mock_service.h
index 576c82542b..c9f2d91dfb 100644
--- a/src/components/functional_module/test/include/mock_service.h
+++ b/src/components/functional_module/test/include/mock_service.h
@@ -61,10 +61,6 @@ class MockService : public Service {
const std::string& module));
MOCK_METHOD2(CheckModule,
bool(const ApplicationId& app_id, const std::string& module));
- MOCK_METHOD3(SetAccess,
- void(const ApplicationId& app_id,
- const std::string& module,
- bool allowed));
MOCK_METHOD1(RemoveHMIFakeParameters,
void(application_manager::MessagePtr& message));
MOCK_CONST_METHOD1(IsRemoteControlApplication,
diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h
index 7c4d53936e..1b27ee7e94 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -469,18 +469,6 @@ class PolicyHandlerInterface {
virtual bool CheckModule(const PTString& app_id, const PTString& module) = 0;
/**
- * Sets access to equipment of vehicle for application by RPC
- * @param device_id unique identifier of device
- * @param app_id policy id application
- * @param module type
- * @param allowed true if access is allowed
- */
- virtual void SetAccess(const PTString& device_id,
- const PTString& app_id,
- const PTString& module,
- bool allowed) = 0;
-
- /**
* @brief Notifies Remote apps about change in permissions
* @param device_id Device on which app is running
* @param application_id ID of app whose permissions are changed
diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h
index 51dfa427a2..2642f600cc 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -540,18 +540,6 @@ class PolicyManager : public usage_statistics::StatisticsManager {
*/
virtual bool CheckModule(const PTString& app_id, const PTString& module) = 0;
- /**
- * Sets access to equipment of vehicle for application by RPC
- * @param dev_id unique identifier of device
- * @param app_id policy id application
- * @param module type
- * @param allowed true if access is allowed
- */
- virtual void SetAccess(const PTString& dev_id,
- const PTString& app_id,
- const PTString& module,
- bool allowed) = 0;
-
/*
* Send OnPermissionsChange notification to mobile app
* when it's permissions are changed.
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
index c4d957f7c3..4d8ed65628 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -514,18 +514,6 @@ class PolicyManager : public usage_statistics::StatisticsManager {
*/
virtual bool CheckModule(const PTString& app_id, const PTString& module) = 0;
- /**
- * Sets access to equipment of vehicle for application by RPC
- * @param dev_id unique identifier of device
- * @param app_id policy id application
- * @param module type
- * @param allowed true if access is allowed
- */
- virtual void SetAccess(const PTString& dev_id,
- const PTString& app_id,
- const PTString& module,
- bool allowed) = 0;
-
/*
* Send OnPermissionsChange notification to mobile app
* when it's permissions are changed.
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
index 8a9223c97d..60420d1f5f 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
@@ -246,12 +246,6 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
bool(const policy::PTString& app_id,
const policy::PTString& module));
- MOCK_METHOD4(SetAccess,
- void(const policy::PTString& device_id,
- const policy::PTString& app_id,
- const policy::PTString& module,
- bool allowed));
-
MOCK_METHOD2(OnRemoteAppPermissionsChanged,
void(const std::string& device_id,
const std::string& application_id));
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
index 11f2b0cdaf..7892de65f3 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
@@ -161,11 +161,6 @@ class MockPolicyManager : public PolicyManager {
const PTString& module));
MOCK_METHOD2(CheckModule,
bool(const PTString& app_id, const PTString& module));
- MOCK_METHOD4(SetAccess,
- void(const PTString& dev_id,
- const PTString& app_id,
- const PTString& module,
- bool allowed));
MOCK_METHOD2(SendAppPermissionsChanged,
void(const std::string& device_id,
const std::string& application_id));
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
index 735915304a..a3f93511c9 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
@@ -160,11 +160,6 @@ class MockPolicyManager : public PolicyManager {
const PTString& module));
MOCK_METHOD2(CheckModule,
bool(const PTString& app_id, const PTString& module));
- MOCK_METHOD4(SetAccess,
- void(const PTString& dev_id,
- const PTString& app_id,
- const PTString& module,
- bool allowed));
MOCK_METHOD2(SendAppPermissionsChanged,
void(const std::string& device_id,
const std::string& application_id));
diff --git a/src/components/policy/policy_external/include/policy/access_remote.h b/src/components/policy/policy_external/include/policy/access_remote.h
index 6fc2141dbd..bf8dc608e6 100644
--- a/src/components/policy/policy_external/include/policy/access_remote.h
+++ b/src/components/policy/policy_external/include/policy/access_remote.h
@@ -92,47 +92,6 @@ typedef std::vector<PTString> RemoteControlParams;
class AccessRemote {
public:
virtual ~AccessRemote() {}
-
- /**
- * Allows access subject to object
- * @param who subject is dev_id and app_id
- * @param what object is group_id
- */
- virtual void Allow(const Subject& who, const Object& what) = 0;
-
- /**
- * Denies access subject to object
- * @param who subject is dev_id and app_id
- * @param what object is group_id
- */
- virtual void Deny(const Subject& who, const Object& what) = 0;
-
- /**
- * Resets access subject to all object
- * @param who subject is dev_id and app_id
- */
- virtual void Reset(const Subject& who) = 0;
-
- /**
- * Resets access to object for all subjects
- * @param what object is group
- */
- virtual void Reset(const Object& what) = 0;
-
- /*
- * Resets all stored consents
- */
- virtual void Reset() = 0;
-
- /**
- * Checks access subject to object
- * @param who subject is dev_id and app_id
- * @param what object is group_id
- * @return allowed if access was given, disallowed if access was denied
- * manual if need to ask driver
- */
- virtual TypeAccess Check(const Subject& who, const Object& what) const = 0;
-
/**
* Checks permissions for module
* @param app_id application ID
diff --git a/src/components/policy/policy_external/include/policy/access_remote_impl.h b/src/components/policy/policy_external/include/policy/access_remote_impl.h
index 1822b6b3ae..f1518e052c 100644
--- a/src/components/policy/policy_external/include/policy/access_remote_impl.h
+++ b/src/components/policy/policy_external/include/policy/access_remote_impl.h
@@ -47,13 +47,6 @@ class AccessRemoteImpl : public AccessRemote {
public:
AccessRemoteImpl();
explicit AccessRemoteImpl(utils::SharedPtr<CacheManager> cache);
-
- virtual void Allow(const Subject& who, const Object& what);
- virtual void Deny(const Subject& who, const Object& what);
- virtual void Reset(const Subject& who);
- virtual void Reset(const Object& what);
- virtual void Reset();
- virtual TypeAccess Check(const Subject& who, const Object& what) const;
virtual bool CheckModuleType(const PTString& app_id,
policy_table::ModuleType module) const;
virtual void SetDefaultHmiTypes(const Subject& who,
diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
index 4257ef4372..93cd07349e 100644
--- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
@@ -192,10 +192,6 @@ class PolicyManagerImpl : public PolicyManager {
virtual bool GetHMITypes(const std::string& application_id,
std::vector<int>* app_types) OVERRIDE;
virtual void set_access_remote(utils::SharedPtr<AccessRemote> access_remote);
- TypeAccess CheckDriverConsent(const Subject& who,
- const Object& what,
- const std::string& rpc,
- const RemoteControlParams& params);
void CheckPTUUpdatesChange(
const utils::SharedPtr<policy_table::Table> pt_update,
const utils::SharedPtr<policy_table::Table> snapshot);
@@ -388,10 +384,6 @@ class PolicyManagerImpl : public PolicyManager {
const PTString& app_id,
const PTString& module);
virtual bool CheckModule(const PTString& app_id, const PTString& module);
- virtual void SetAccess(const PTString& dev_id,
- const PTString& app_id,
- const PTString& module,
- bool allowed);
virtual void SendAppPermissionsChanged(const std::string& device_id,
const std::string& application_id);
virtual bool GetModuleTypes(const std::string& policy_app_id,
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 8d3c7c2ebc..779933906a 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -1989,43 +1989,9 @@ bool PolicyManagerImpl::CheckModule(const PTString& app_id,
access_remote_->CheckModuleType(app_id, module_type);
}
-TypeAccess PolicyManagerImpl::CheckDriverConsent(
- const Subject& who,
- const Object& what,
- const std::string& rpc,
- const RemoteControlParams& params) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- return access_remote_->Check(who, what);
-}
-
-void PolicyManagerImpl::SetAccess(const PTString& dev_id,
- const PTString& app_id,
- const PTString& module,
- bool allowed) {
- LOG4CXX_AUTO_TRACE(logger_);
- policy_table::ModuleType module_type;
- bool is_valid = EnumFromJsonString(module, &module_type);
- if (!is_valid) {
- return;
- }
-
- Subject who = {dev_id, app_id};
- Object what = {module_type};
- LOG4CXX_DEBUG(logger_,
- "Driver's consent: " << who << ", " << what << " is "
- << std::boolalpha << allowed);
- if (allowed) {
- access_remote_->Allow(who, what);
- } else {
- access_remote_->Deny(who, what);
- }
-}
-
void PolicyManagerImpl::SendHMILevelChanged(const Subject& who) {
std::string default_hmi("NONE");
if (GetDefaultHmi(who.app_id, &default_hmi)) {
- access_remote_->Reset(who);
listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi);
} else {
LOG4CXX_WARN(logger_,
diff --git a/src/components/policy/policy_regular/include/policy/access_remote.h b/src/components/policy/policy_regular/include/policy/access_remote.h
index dd0cbb0ce5..0097b3d5c7 100644
--- a/src/components/policy/policy_regular/include/policy/access_remote.h
+++ b/src/components/policy/policy_regular/include/policy/access_remote.h
@@ -93,46 +93,6 @@ class AccessRemote {
public:
virtual ~AccessRemote() {}
/**
- * Allows access subject to object
- * @param who subject is dev_id and app_id
- * @param what object is group_id
- */
- virtual void Allow(const Subject& who, const Object& what) = 0;
-
- /**
- * Denies access subject to object
- * @param who subject is dev_id and app_id
- * @param what object is group_id
- */
- virtual void Deny(const Subject& who, const Object& what) = 0;
-
- /**
- * Resets access subject to all object
- * @param who subject is dev_id and app_id
- */
- virtual void Reset(const Subject& who) = 0;
-
- /**
- * Resets access to object for all subjects
- * @param what object is group
- */
- virtual void Reset(const Object& what) = 0;
-
- /*
- * Resets all stored consents
- */
- virtual void Reset() = 0;
-
- /**
- * Checks access subject to object
- * @param who subject is dev_id and app_id
- * @param what object is group_id
- * @return allowed if access was given, disallowed if access was denied
- * manual if need to ask driver
- */
- virtual TypeAccess Check(const Subject& who, const Object& what) const = 0;
-
- /**
* Checks permissions for module
* @param app_id application ID
* @param module type
diff --git a/src/components/policy/policy_regular/include/policy/access_remote_impl.h b/src/components/policy/policy_regular/include/policy/access_remote_impl.h
index 8b89a42744..bf9d8e1d36 100644
--- a/src/components/policy/policy_regular/include/policy/access_remote_impl.h
+++ b/src/components/policy/policy_regular/include/policy/access_remote_impl.h
@@ -51,13 +51,6 @@ class AccessRemoteImpl : public AccessRemote {
AccessRemoteImpl();
explicit AccessRemoteImpl(utils::SharedPtr<CacheManager> cache);
-
- virtual void Allow(const Subject& who, const Object& what);
- virtual void Deny(const Subject& who, const Object& what);
- virtual void Reset(const Subject& who);
- virtual void Reset(const Object& what);
- virtual void Reset();
- virtual TypeAccess Check(const Subject& who, const Object& what) const;
virtual bool CheckModuleType(const PTString& app_id,
policy_table::ModuleType module) const;
virtual void SetDefaultHmiTypes(const Subject& who,
@@ -82,7 +75,6 @@ class AccessRemoteImpl : public AccessRemote {
bool CompareParameters(const policy_table::Strings& parameters,
RemoteControlParams* input) const;
utils::SharedPtr<CacheManager> cache_;
- AccessControlList acl_;
HMIList hmi_types_;
#ifdef BUILD_TESTS
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 0f1a298875..648fd85db6 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
@@ -192,10 +192,7 @@ class PolicyManagerImpl : public PolicyManager {
virtual bool GetHMITypes(const std::string& application_id,
std::vector<int>* app_types) OVERRIDE;
virtual void set_access_remote(utils::SharedPtr<AccessRemote> access_remote);
- TypeAccess CheckDriverConsent(const Subject& who,
- const Object& what,
- const std::string& rpc,
- const RemoteControlParams& params);
+
void CheckPTUUpdatesChange(
const utils::SharedPtr<policy_table::Table> pt_update,
const utils::SharedPtr<policy_table::Table> snapshot);
@@ -359,10 +356,6 @@ class PolicyManagerImpl : public PolicyManager {
const PTString& app_id,
const PTString& module);
virtual bool CheckModule(const PTString& app_id, const PTString& module);
- virtual void SetAccess(const PTString& dev_id,
- const PTString& app_id,
- const PTString& module,
- bool allowed);
virtual void SendAppPermissionsChanged(const std::string& device_id,
const std::string& application_id);
virtual bool GetModuleTypes(const std::string& policy_app_id,
diff --git a/src/components/policy/policy_regular/src/access_remote_impl.cc b/src/components/policy/policy_regular/src/access_remote_impl.cc
index 5f7959ebee..dfdb6ab579 100644
--- a/src/components/policy/policy_regular/src/access_remote_impl.cc
+++ b/src/components/policy/policy_regular/src/access_remote_impl.cc
@@ -110,29 +110,10 @@ struct ToModuleType {
}
};
-AccessRemoteImpl::AccessRemoteImpl() : cache_(new CacheManager()), acl_() {}
+AccessRemoteImpl::AccessRemoteImpl() : cache_(new CacheManager()) {}
AccessRemoteImpl::AccessRemoteImpl(utils::SharedPtr<CacheManager> cache)
- : cache_(cache), acl_() {}
-
-TypeAccess AccessRemoteImpl::Check(const Subject& who,
- const Object& what) const {
- LOG4CXX_AUTO_TRACE(logger_);
- AccessControlList::const_iterator i = acl_.find(what);
- if (i != acl_.end()) {
- const AccessControlRow& row = i->second;
- AccessControlRow::const_iterator j = row.find(who);
- if (j != row.end()) {
- // who has permissions
- TypeAccess ret = j->second;
- LOG4CXX_TRACE(logger_,
- "Subject " << who << " has permissions " << ret
- << " to object " << what);
- return ret;
- }
- }
- return TypeAccess::kAllowed;
-}
+ : cache_(cache) {}
bool AccessRemoteImpl::CheckModuleType(const PTString& app_id,
policy_table::ModuleType module) const {
@@ -197,30 +178,6 @@ bool AccessRemoteImpl::CompareParameters(
return input->empty();
}
-void AccessRemoteImpl::Allow(const Subject& who, const Object& what) {
- LOG4CXX_AUTO_TRACE(logger_);
- acl_[what][who] = TypeAccess::kAllowed;
-}
-
-void AccessRemoteImpl::Deny(const Subject& who, const Object& what) {
- LOG4CXX_AUTO_TRACE(logger_);
- acl_[what][who] = TypeAccess::kDisallowed;
-}
-
-void AccessRemoteImpl::Reset(const Subject& who) {
- LOG4CXX_AUTO_TRACE(logger_);
- std::for_each(acl_.begin(), acl_.end(), Erase(who));
-}
-
-void AccessRemoteImpl::Reset(const Object& what) {
- LOG4CXX_AUTO_TRACE(logger_);
- acl_.erase(what);
-}
-
-void AccessRemoteImpl::Reset() {
- acl_.clear();
-}
-
void AccessRemoteImpl::SetDefaultHmiTypes(const Subject& who,
const std::vector<int>& hmi_types) {
LOG4CXX_AUTO_TRACE(logger_);
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 7075d5fc82..db076e3108 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -1219,43 +1219,9 @@ bool PolicyManagerImpl::CheckModule(const PTString& app_id,
access_remote_->CheckModuleType(app_id, module_type);
}
-TypeAccess PolicyManagerImpl::CheckDriverConsent(
- const Subject& who,
- const Object& what,
- const std::string& rpc,
- const RemoteControlParams& params) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- return access_remote_->Check(who, what);
-}
-
-void PolicyManagerImpl::SetAccess(const PTString& dev_id,
- const PTString& app_id,
- const PTString& module,
- bool allowed) {
- LOG4CXX_AUTO_TRACE(logger_);
- policy_table::ModuleType module_type;
- bool is_valid = EnumFromJsonString(module, &module_type);
- if (!is_valid) {
- return;
- }
-
- Subject who = {dev_id, app_id};
- Object what = {module_type};
- LOG4CXX_DEBUG(logger_,
- "Driver's consent: " << who << ", " << what << " is "
- << std::boolalpha << allowed);
- if (allowed) {
- access_remote_->Allow(who, what);
- } else {
- access_remote_->Deny(who, what);
- }
-}
-
void PolicyManagerImpl::SendHMILevelChanged(const Subject& who) {
std::string default_hmi("NONE");
if (GetDefaultHmi(who.app_id, &default_hmi)) {
- access_remote_->Reset(who);
listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi);
} else {
LOG4CXX_WARN(logger_,
diff --git a/src/components/policy/policy_regular/test/access_remote_impl_test.cc b/src/components/policy/policy_regular/test/access_remote_impl_test.cc
index 0b6e2aa1fc..65ed4fdf13 100644
--- a/src/components/policy/policy_regular/test/access_remote_impl_test.cc
+++ b/src/components/policy/policy_regular/test/access_remote_impl_test.cc
@@ -35,109 +35,6 @@
namespace policy {
-TEST(AccessRemoteImplTest, Allow) {
- AccessRemoteImpl access_remote;
- Subject who = {"dev1", "12345"};
- Object what = {policy_table::MT_RADIO};
- access_remote.Allow(who, what);
- AccessRemoteImpl::AccessControlList::const_iterator i =
- access_remote.acl_.find(what);
- ASSERT_NE(access_remote.acl_.end(), i);
- AccessRemoteImpl::AccessControlRow::const_iterator j = i->second.find(who);
- ASSERT_NE(i->second.end(), j);
- EXPECT_EQ(TypeAccess::kAllowed, j->second);
-}
-
-TEST(AccessRemoteImplTest, KeyMapTest) {
- // Testing operator < to use as key of map
- AccessRemoteImpl access_remote;
- Subject who = {"dev1", "12345"};
- Object what1 = {policy_table::MT_RADIO};
- Object what2 = {policy_table::MT_CLIMATE};
- access_remote.Allow(who, what1);
- access_remote.Allow(who, what2);
- ASSERT_EQ(2u, access_remote.acl_.size());
-}
-
-TEST(AccessRemoteImplTest, Deny) {
- AccessRemoteImpl access_remote;
- Subject who = {"dev1", "12345"};
- Object what = {policy_table::MT_RADIO};
- access_remote.Deny(who, what);
- AccessRemoteImpl::AccessControlList::const_iterator i =
- access_remote.acl_.find(what);
- ASSERT_NE(access_remote.acl_.end(), i);
- AccessRemoteImpl::AccessControlRow::const_iterator j = i->second.find(who);
- ASSERT_NE(i->second.end(), j);
- EXPECT_EQ(TypeAccess::kDisallowed, j->second);
-}
-
-TEST(AccessRemoteImplTest, ChangeAccess) {
- AccessRemoteImpl access_remote;
- Subject who = {"dev1", "12345"};
- Object what = {policy_table::MT_RADIO};
- access_remote.Allow(who, what);
- ASSERT_EQ(TypeAccess::kAllowed, access_remote.acl_[what][who]);
- access_remote.Deny(who, what);
- ASSERT_EQ(TypeAccess::kDisallowed, access_remote.acl_[what][who]);
- access_remote.Allow(who, what);
- EXPECT_EQ(TypeAccess::kAllowed, access_remote.acl_[what][who]);
-}
-
-TEST(AccessRemoteImplTest, ResetBySubject) {
- AccessRemoteImpl access_remote;
- Subject who = {"dev1", "12345"};
- Object what1 = {policy_table::MT_RADIO};
- Object what2 = {policy_table::MT_CLIMATE};
- access_remote.Allow(who, what1);
- access_remote.Deny(who, what2);
- ASSERT_EQ(2u, access_remote.acl_.size());
- ASSERT_EQ(1u, access_remote.acl_[what1].size());
- ASSERT_EQ(1u, access_remote.acl_[what2].size());
-
- access_remote.Reset(who);
- ASSERT_EQ(2u, access_remote.acl_.size());
- EXPECT_TRUE(access_remote.acl_[what1].empty());
- EXPECT_TRUE(access_remote.acl_[what2].empty());
-}
-
-TEST(AccessRemoteImplTest, ResetByObject) {
- AccessRemoteImpl access_remote;
- Subject who1 = {"dev1", "12345"};
- Subject who2 = {"dev2", "123456"};
- Object what = {policy_table::MT_RADIO};
- access_remote.Allow(who1, what);
- access_remote.Deny(who2, what);
- ASSERT_EQ(1u, access_remote.acl_.size());
- ASSERT_EQ(2u, access_remote.acl_[what].size());
-
- access_remote.Reset(what);
- EXPECT_TRUE(access_remote.acl_.empty());
-}
-
-TEST(AccessRemoteImplTest, CheckAllowed) {
- AccessRemoteImpl access_remote;
- Subject who = {"dev1", "12345"};
- Object what = {policy_table::MT_RADIO};
- access_remote.Allow(who, what);
-
- EXPECT_EQ(TypeAccess::kAllowed, access_remote.Check(who, what));
-}
-
-TEST(AccessRemoteImplTest, CheckDisallowed) {
- AccessRemoteImpl access_remote;
- Subject who = {"dev1", "12345"};
- Subject who1 = {"dev1", "123456"};
- Object what = {policy_table::MT_RADIO};
-
- access_remote.Allow(who, what);
- EXPECT_EQ(TypeAccess::kAllowed, access_remote.Check(who1, what));
-
- access_remote.Reset(who);
- access_remote.Deny(who1, what);
- EXPECT_EQ(TypeAccess::kDisallowed, access_remote.Check(who1, what));
-}
-
TEST(AccessRemoteImplTest, CheckModuleType) {
AccessRemoteImpl access_remote;
access_remote.cache_->pt_ = new policy_table::Table();
diff --git a/src/components/remote_control/src/commands/base_command_request.cc b/src/components/remote_control/src/commands/base_command_request.cc
index 32a12ed8fd..150d79d18b 100644
--- a/src/components/remote_control/src/commands/base_command_request.cc
+++ b/src/components/remote_control/src/commands/base_command_request.cc
@@ -368,7 +368,7 @@ application_manager::TypeAccess BaseCommandRequest::CheckAccess(
return service_->CheckAccess(app_->app_id(), module);
}
-bool BaseCommandRequest::CheckDriverConsent() {
+bool BaseCommandRequest:: CheckDriverConsent() {
LOG4CXX_AUTO_TRACE(logger_);
RCAppExtensionPtr extension = GetAppExtension(app_);
if (!extension) {
@@ -535,8 +535,6 @@ void BaseCommandRequest::ProcessAccessResponse(
LOG4CXX_DEBUG(logger_,
"Setting allowed access for " << app_->app_id() << " for "
<< module);
- service_->SetAccess(app_->app_id(), module, is_allowed);
-
if (is_allowed) {
rc_module_.resource_allocation_manager().ForceAcquireResource(
module, app_->app_id());