Add the option to check Internet privilege in dotnettool for the FOTA
[platform/core/dotnet/launcher.git] / NativeLauncher / installer-plugin / dotnet_apptype_plugin.cc
index c5c9786..48e0ed3 100644 (file)
 #include "multi_target_resolver.h"
 #include "ni_common.h"
 #include "profile_common.h"
+#include "privilege_common.h"
 #include "launcher_env.h"
 
-#include <vector>
-#include <app-runtime.h>
-
 #ifdef  LOG_TAG
 #undef  LOG_TAG
 #endif
@@ -33,25 +31,6 @@ typedef struct _xmlDoc xmlDoc;
 typedef xmlDoc* xmlDocPtr;
 
 bool pluginInstalled = false;
-static const char* INTERNET_PRIVILEGE = "http://tizen.org/privilege/internet";
-static int UID_OWNER = 5001;
-
-static void checkPrivilegeAndDisableIPv6(const char* pkgId, const std::string& rootPath)
-{
-       int res = 0;
-       if (security_manager_app_has_privilege(pkgId, INTERNET_PRIVILEGE, UID_OWNER, &res) == SECURITY_MANAGER_SUCCESS) {
-               if (res != 1) {
-                       std::string filePath = rootPath + "/bin/" + DISABLE_IPV6_FILE;
-                       std::ofstream output(filePath);
-                       if (exist(filePath)) {
-                               _INFO("File to disable IPv6 is created successfully");
-                       } else {
-                               _ERR("Failed to create file to disable IPv6 [%s]", pkgId);
-                       }
-                       output.close();
-               }
-       }
-}
 
 extern "C" int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr doc, const char* pkgId)
 {
@@ -86,7 +65,7 @@ extern "C" int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr doc, const char* pkgId)
                _ERR("Failed to resolve platform specific resources of nuget");
        }
 
-       checkPrivilegeAndDisableIPv6(pkgId, rootPath);
+       checkInternetPrivilegeAndDisableIPv6(pkgId, rootPath);
 
        return 0;
 }