[Download] Privilege checks moved to JS.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Thu, 30 Apr 2015 13:00:07 +0000 (15:00 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Mon, 4 May 2015 08:08:41 +0000 (17:08 +0900)
Privileges need to be checked before validation of arguments.

Change-Id: I4d137667f531a4ca8f4899ac3ef1d240c63eb9cb
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/download/download_api.js
src/download/download_instance.cc

index 96542b8..f8af8b3 100644 (file)
@@ -169,6 +169,8 @@ function DownloadManager() {
 }
 
 DownloadManager.prototype.start = function() {
+  xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.DOWNLOAD);
+
   var args = validator_.validateArgs(arguments, [
     {'name' : 'downloadRequest', 'type': types_.PLATFORM_OBJECT, 'values': tizen.DownloadRequest},
     {'name' : 'downloadCallback', 'type': types_.LISTENER,
index a32381a..14d7d74 100644 (file)
@@ -20,12 +20,6 @@ namespace download {
 std::vector<DownloadInstance*> DownloadInstance::instances_;
 std::mutex DownloadInstance::instances_mutex_;
 
-namespace {
-// The privileges that required in Download API
-const std::string kPrivilegeDownload = "http://tizen.org/privilege/download";
-
-}  // namespace
-
 using common::NotFoundException;
 using common::UnknownException;
 using common::NetworkException;
@@ -370,7 +364,6 @@ void DownloadInstance::progress_changed_cb
 
 void DownloadInstance::DownloadManagerStart
   (const picojson::value& args, picojson::object& out) {
-  CHECK_PRIVILEGE_ACCESS(kPrivilegeDownload, &out);
   CHECK_EXIST(args, "callbackId", out)
 
   int ret, downlodId;