Changed ACL codes in remote app control service 19/99319/4
authorkmook <kmook.choi@samsung.com>
Tue, 22 Nov 2016 10:42:35 +0000 (19:42 +0900)
committerkmook <kmook.choi@samsung.com>
Fri, 25 Nov 2016 05:56:19 +0000 (14:56 +0900)
Change-Id: I18b83df6378dd0fcc1e4a63078e8aed37fbefc23
Signed-off-by: kmook <kmook.choi@samsung.com>
daemon/CMakeLists.txt
daemon/access_control/Privilege.cpp
daemon/service_provider/RemoteAppControlServiceProvider.cpp [changed mode: 0755->0644]
packaging/d2d-conv-manager.spec

index 3c35923..90c5089 100755 (executable)
@@ -30,7 +30,7 @@ ENDIF("${PROFILE}" STREQUAL "mobile")
 IF("${PROFILE}" STREQUAL "tv")
        ADD_DEFINITIONS("-D_TV_")
     IF(${D2D_INTERNAL_ACL} EQUAL 0)
-        SET(provider_deps "${provider_deps} acl-proxy-api")
+        SET(provider_deps "${provider_deps} capi-register-device")
     ENDIF(${D2D_INTERNAL_ACL} EQUAL 0)
 ENDIF("${PROFILE}" STREQUAL "tv")
 
index 0d9ac0f..4df805a 100755 (executable)
@@ -58,7 +58,7 @@ public:
 
 bool conv::privilege_manager::isAllowed(const conv::Credentials *creds, const char *privilege)
 {
-       IF_FAIL_RETURN(creds && privilege, true);
+       IF_FAIL_RETURN(creds && privilege, false);
 
        std::string priv = "http://tizen.org/privilege/";
        priv += privilege;
old mode 100755 (executable)
new mode 100644 (file)
index db35ef4..b27c294
@@ -25,7 +25,7 @@
 
 using namespace conv::acl_manager;
 #else
-#include <RemoteACLInterface.h>
+#include <rdm_iface.h>
 #endif
 
 using namespace std;
@@ -76,12 +76,23 @@ conv::RemoteAppControlServiceProvider::RemoteAppControlServiceProvider()
        }
 
        vconf_notify_key_changed(VCONFKEY_SETAPPL_D2D_CONVERGENCE_SERVICE, vconf_update_cb, this);
+#if !defined(_D2D_INTERNAL_ACL_)
+       int error = rdm_init();
+       if (error != RDM_ERROR_SUCCESS)
+               _E("rdm init error : %d", error);
+#endif
 }
 
 conv::RemoteAppControlServiceProvider::~RemoteAppControlServiceProvider()
 {
        app_control_cb_map.clear();
        response_cb_map.clear();
+
+#if !defined(_D2D_INTERNAL_ACL_)
+       int error = rdm_deinit();
+       if (error != RDM_ERROR_SUCCESS)
+               _E("rdm deinit error : %d", error);
+#endif
 }
 
 int conv::RemoteAppControlServiceProvider::handleVconfUpdate(keynode_t *node)
@@ -237,6 +248,7 @@ static int __access_control(iotcon_request_h request, iotcon_attributes_h attrib
        IF_FAIL_RETURN_TAG(ret == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_PARAMETER, _E, "iotcon_representation_get_attributes() Fail(%d)", ret);
 
        if (!strcmp(CONV_ACCESS_CONTROL_REQUEST, access_request_type)) {
+#if defined(_D2D_INTERNAL_ACL_)
                ACManagerPolicy acManagerPolicy = ACMANAGER_POLICY_U;
                IF_FAIL_RETURN_TAG(AddACLDevice(macAddress, deviceName, ip.c_str(), &acManagerPolicy) == ACLResult_OK, CONV_ERROR_INVALID_OPERATION, _E, "AddACLDevice failed");
 
@@ -250,13 +262,29 @@ static int __access_control(iotcon_request_h request, iotcon_attributes_h attrib
                        _D("UNDECIDED");
                        policy = CONV_ACCESS_CONTROL_DENIED;
                } else if (acManagerPolicy == ACMANAGER_POLICY_U2) {
-#if defined(_D2D_INTERNAL_ACL_)
                        _D("UNDECIDED");
                        conv::acl_manager::LaunchPasskeyShowPopup(deviceName);
                        policy = CONV_ACCESS_CONTROL_PASSKEY_REQUEST;
-#endif
                }
                _D("acManagerPolicy:%d", acManagerPolicy);
+#else
+               rdm_device_s rdmDevice;
+               IF_FAIL_RETURN_TAG(rdm_init_device(&rdmDevice, deviceName, NULL, macAddress, NULL, RDM_DEVICE_TYPE_PHONE, RDM_DEVICE_ICON_PHONE_DEFAULT) == RDM_ERROR_SUCCESS, CONV_ERROR_INVALID_OPERATION, _E, "rdm_init_device failed");
+
+               ret = rdm_request_access(&rdmDevice);
+
+               if (ret == RDM_ERROR_SUCCESS) {
+                       _D("PERMITTED");
+                       policy = CONV_ACCESS_CONTROL_PERMITTED;
+               } else if (ret == RDM_ERROR_DEVICE_IS_DENIED) {
+                       _D("DENIED");
+                       policy = CONV_ACCESS_CONTROL_DENIED;
+               } else if (ret == RDM_ERROR_INPROGRESS){
+                       _D("UNDECIDED");
+                       policy = CONV_ACCESS_CONTROL_DENIED;
+               }
+               _D("rdm_request_access:%d", ret);
+#endif
        } else if (!strcmp(CONV_ACCESS_CONTROL_PASSKEY_RESPONSE, access_request_type)) {
 #if defined(_D2D_INTERNAL_ACL_)
                char *input_passkey;
@@ -314,6 +342,8 @@ static int __app_control_launch(iotcon_request_h request, iotcon_attributes_h at
        IF_FAIL_RETURN_TAG(conv::util::getPeerMac(ip, -1, macAddress), CONV_ERROR_INVALID_PARAMETER, _E, "getPeerMac failed");
 
        _D("Device IP : %s, Mac : %s", ip.c_str(), macAddress);
+
+#if defined(_D2D_INTERNAL_ACL_)
        ACManagerPolicy acManagerPolicy = ACMANAGER_POLICY_U;
 
        IF_FAIL_RETURN_TAG(GetACLState(macAddress, &acManagerPolicy) == ACLResult_OK, CONV_ERROR_INVALID_OPERATION, _E, "ACL check failed");
@@ -323,6 +353,25 @@ static int __app_control_launch(iotcon_request_h request, iotcon_attributes_h at
                _D("Device is not permitted %d", acManagerPolicy);
                return CONV_ERROR_INVALID_OPERATION;
        }
+#else
+       rdm_status_e eStatus = RDM_STATUS_NONE;
+       ret = rdm_get_status(macAddress, RDM_TECH_IND_WIFI, &eStatus);
+
+       if (ret == RDM_ERROR_SUCCESS) {
+           if (eStatus == RDM_STATUS_ALLOW) {
+               _D("PERMITTED");
+           } else {
+               _D("Device is not permitted %d", eStatus);
+               return CONV_ERROR_INVALID_OPERATION;
+           }
+       } else if (ret == RDM_ERROR_DEVICE_NOT_FOUND) {
+           _D("Device is not found");
+       return CONV_ERROR_INVALID_OPERATION;
+       } else {
+           _D("rdm_get_status failed (%d)", ret);
+           return CONV_ERROR_INVALID_OPERATION;
+       }
+#endif
 
        app_control_h app_control;
        int reply = 0;
index 1207422..aa05b0f 100755 (executable)
@@ -46,8 +46,7 @@ BuildRequires: libcurl-devel
 
 %if "%{?BUILD_PROFILE}" == "tv"
 %if %{?INTERNAL_ACL} == 0
-BuildRequires: pkgconfig(acl-proxy-api)
-BuildRequires: pkgconfig(securestorage-client)
+BuildRequires: pkgconfig(capi-register-device)
 %endif
 %endif