From 8e35f825a8a221c4890a709df82f696d1761d2d2 Mon Sep 17 00:00:00 2001
From: Pawel Andruszkiewicz
Date: Thu, 19 Mar 2015 15:10:37 +0100
Subject: [PATCH] [NBS] Added privilege checks.
Change-Id: I5cbcfd76c3bcb4b220e142d11a75baab952bc16e
---
src/networkbearerselection/networkbearerselection_instance.cc | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/networkbearerselection/networkbearerselection_instance.cc b/src/networkbearerselection/networkbearerselection_instance.cc
index 6925f3a..aefbf9c 100644
--- a/src/networkbearerselection/networkbearerselection_instance.cc
+++ b/src/networkbearerselection/networkbearerselection_instance.cc
@@ -16,7 +16,9 @@ namespace networkbearerselection {
namespace {
// The privileges that required in NetworkBearerSelection API
-const std::string kPrivilegeNetworkBearerSelection = "";
+const std::string kPrivilegeNetworkBearerSelection = "http://tizen.org/privilege/networkbearerselection";
+const std::string kPrivilegeInternet = "http://tizen.org/privilege/internet";
+const std::vector kNbsPrivileges{kPrivilegeNetworkBearerSelection, kPrivilegeInternet};
} // namespace
@@ -55,6 +57,9 @@ void NetworkBearerSelectionInstance::NetworkBearerSelectionRequestRouteToHost(
const picojson::value& args,
picojson::object& out) {
LoggerD("enter");
+
+ CHECK_PRIVILEGE_ACCESS(kNbsPrivileges, &out);
+
CHECK_EXIST(args, "domainName", out)
CHECK_EXIST(args, "id", out)
@@ -76,6 +81,9 @@ void NetworkBearerSelectionInstance::NetworkBearerSelectionReleaseRouteToHost(
const picojson::value& args,
picojson::object& out) {
LoggerD("enter");
+
+ CHECK_PRIVILEGE_ACCESS(kNbsPrivileges, &out);
+
CHECK_EXIST(args, "callbackId", out)
CHECK_EXIST(args, "domainName", out)
const double callback_id = args.get("callbackId").get();
--
2.7.4