Add privileges to check each APIs 69/105569/1
authorSungbae Yoo <sungbae.yoo@samsung.com>
Mon, 19 Dec 2016 04:43:29 +0000 (13:43 +0900)
committerSungbae Yoo <sungbae.yoo@samsung.com>
Mon, 19 Dec 2016 04:43:29 +0000 (13:43 +0900)
Change-Id: Ie146c086b37bc0e6b8cd0f0e3914653b0afa860b
Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
server/app-proxy.cpp
server/manager.cpp
server/package-proxy.cpp

index 38b6e16..75801c1 100644 (file)
@@ -28,6 +28,9 @@
 
 #include "rmi/app-proxy.h"
 
+#define PRIVILEGE_APP_LAUNCH "http://tizen.org/privilege/appmanager.launch"
+#define PRIVILEGE_APP_KILL "http://tizen.org/privilege/appmanager.kill"
+
 namespace Krate {
 
 namespace {
@@ -53,9 +56,9 @@ AppProxy::AppProxy(KrateControlContext& ctx) :
        context.registerParametricMethod(this, "", (bool)(AppProxy::nextIterator)(int));
        context.registerParametricMethod(this, "", (int)(AppProxy::destroyIterator)(int));
 
-       context.registerParametricMethod(this, "", (int)(AppProxy::launch)(std::string, AppProxy::Bundle));
-       context.registerParametricMethod(this, "", (int)(AppProxy::resume)(std::string, std::string));
-       context.registerParametricMethod(this, "", (int)(AppProxy::terminate)(std::string, std::string));
+       context.registerParametricMethod(this, PRIVILEGE_APP_LAUNCH, (int)(AppProxy::launch)(std::string, AppProxy::Bundle));
+       context.registerParametricMethod(this, PRIVILEGE_APP_LAUNCH, (int)(AppProxy::resume)(std::string, std::string));
+       context.registerParametricMethod(this, PRIVILEGE_APP_KILL, (int)(AppProxy::terminate)(std::string, std::string));
        context.registerParametricMethod(this, "", (int)(AppProxy::isRunning)(std::string, std::string));
 }
 
index 1acd6d9..70de04d 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "rmi/manager.h"
 
+#define PRIVILEGE_INTERNAL_PLATFORM "http://tizen.org/privilege/internal/default/platform"
 #define KRATE_DELEGATOR_APP  "org.tizen.keyguard"
 #define DEFAULT_ICON_PATH  ICON_PATH "/default_icon.png"
 #define NOTIFICATION_SUB_ICON_PATH  ICON_PATH "/notification_sub_icon.png"
@@ -506,13 +507,13 @@ void notiProxyCallback(void *data, notification_type_e type, notification_op *op
 Manager::Manager(KrateControlContext& ctx) :
        context(ctx)
 {
-       context.registerParametricMethod(this, "", (int)(Manager::createKrate)(std::string, std::string));
-       context.registerParametricMethod(this, "", (int)(Manager::removeKrate)(std::string));
-       context.registerParametricMethod(this, "", (int)(Manager::lockKrate)(std::string));
-       context.registerParametricMethod(this, "", (int)(Manager::unlockKrate)(std::string));
+       context.registerParametricMethod(this, PRIVILEGE_INTERNAL_PLATFORM, (int)(Manager::createKrate)(std::string, std::string));
+       context.registerParametricMethod(this, PRIVILEGE_INTERNAL_PLATFORM, (int)(Manager::removeKrate)(std::string));
+       context.registerParametricMethod(this, PRIVILEGE_INTERNAL_PLATFORM, (int)(Manager::lockKrate)(std::string));
+       context.registerParametricMethod(this, PRIVILEGE_INTERNAL_PLATFORM, (int)(Manager::unlockKrate)(std::string));
        context.registerParametricMethod(this, "", (int)(Manager::getKrateState)(std::string));
        context.registerParametricMethod(this, "", (std::vector<std::string>)(Manager::getKrateList)(int));
-       context.registerParametricMethod(this, "", (int)(Manager::resetKratePassword)(std::string, std::string));
+       context.registerParametricMethod(this, PRIVILEGE_INTERNAL_PLATFORM, (int)(Manager::resetKratePassword)(std::string, std::string));
 
        context.createNotification("Manager::created");
        context.createNotification("Manager::removed");
index 44513d4..3a5c7e8 100644 (file)
@@ -24,6 +24,8 @@
 
 #include "rmi/package-proxy.h"
 
+#define PRIVLEGE_PACKAGE_ADMIN "http://tizen.org/privilege/packagemanager.admin"
+
 namespace Krate {
 
 PackageProxy::PackageProxy(KrateControlContext& ctx) :
@@ -32,8 +34,8 @@ PackageProxy::PackageProxy(KrateControlContext& ctx) :
        context.registerParametricMethod(this, "", (PackageProxy::PackageInfo)(PackageProxy::getPackageInfo)(std::string, std::string));
        context.registerParametricMethod(this, "", (std::vector<std::string>)(PackageProxy::getPackageList)(std::string));
 
-       context.registerParametricMethod(this, "", (int)(PackageProxy::install)(std::string, std::string));
-       context.registerParametricMethod(this, "", (int)(PackageProxy::uninstall)(std::string, std::string));
+       context.registerParametricMethod(this, PRIVLEGE_PACKAGE_ADMIN, (int)(PackageProxy::install)(std::string, std::string));
+       context.registerParametricMethod(this, PRIVLEGE_PACKAGE_ADMIN, (int)(PackageProxy::uninstall)(std::string, std::string));
 }
 
 PackageProxy::~PackageProxy()