From: Soyoung Kim Date: Wed, 27 Mar 2013 09:07:48 +0000 (+0900) Subject: write privilege list to manifest.xml X-Git-Tag: accepted/tizen_2.1/20130425.023916~18^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43e2857cad009774aed7a276baaace193a849eb8;p=framework%2Fweb%2Fwrt-installer.git write privilege list to manifest.xml [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] For privacy access control. If widget use prilege installer write a list to manifest.xml [SCMRequest] N/A Change-Id: Ieb6d3666567dd37a383893ba6721683b42bb400a --- diff --git a/src/jobs/widget_install/manifest.cpp b/src/jobs/widget_install/manifest.cpp index 1b1dbd7..d78fbac 100644 --- a/src/jobs/widget_install/manifest.cpp +++ b/src/jobs/widget_install/manifest.cpp @@ -197,6 +197,10 @@ void Manifest::serialize(xmlTextWriterPtr writer) { acc->serialize(writer); } + + if (!this->privileges.isEmpty()) { + this->privileges.serialize(writer); + } } endElement(writer); } @@ -459,5 +463,19 @@ void Account::serialize(xmlTextWriterPtr writer) } endElement(writer); } + +void Privilege::serialize(xmlTextWriterPtr writer) +{ + startElement(writer, "privileges"); + { + FOREACH(it, this->name) + { + startElement(writer, "privilege"); + writeText(writer, *it); + endElement(writer); + } + } + endElement(writer); +} } //namespace Jobs } //namespace WidgetInstall diff --git a/src/jobs/widget_install/manifest.h b/src/jobs/widget_install/manifest.h index 28fed98..20236a4 100644 --- a/src/jobs/widget_install/manifest.h +++ b/src/jobs/widget_install/manifest.h @@ -176,6 +176,27 @@ class Account AccountProviderType provider; }; +class Privilege +{ + public: + Privilege() {} + void addPrivilegeName(const DPL::String &x) + { + this->name.push_back(x); + } + bool isEmpty() + { + return this->name.empty(); + } + + void serialize(xmlTextWriterPtr writer); + + private: + std::list name; +}; + +typedef Privilege PrivilegeType; + /** * @brief ime-application element */ @@ -478,6 +499,11 @@ class Manifest this->account.push_back(x); } + void addPrivileges(const PrivilegeType &x) + { + this->privileges = x; + } + void setInstallLocation(const InstallLocationType &x) { this->installLocation = x; @@ -512,6 +538,8 @@ class Manifest PackageType type; NmtokenType version; std::list account; + PrivilegeType privileges; + }; } //namespace Jobs } //namespace WidgetInstall diff --git a/src/jobs/widget_install/task_manifest_file.cpp b/src/jobs/widget_install/task_manifest_file.cpp index 0c66504..95b53c5 100644 --- a/src/jobs/widget_install/task_manifest_file.cpp +++ b/src/jobs/widget_install/task_manifest_file.cpp @@ -582,6 +582,7 @@ void TaskManifestFile::writeManifest(const DPL::String & path) setAppCategory(uiApp); setLiveBoxInfo(manifest); setAccount(manifest); + setPrivilege(manifest); manifest.addUiApplication(uiApp); manifest.generate(path); @@ -1023,5 +1024,20 @@ void TaskManifestFile::setAccount(Manifest& manifest) manifest.addAccount(accountInfo); } +void TaskManifestFile::setPrivilege(Manifest& manifest) +{ + WrtDB::ConfigParserData::PrivilegeList privileges = + m_context.widgetConfig.configInfo.privilegeList; + + PrivilegeType privilege; + + FOREACH(it, privileges) + { + privilege.addPrivilegeName(it->name); + } + + manifest.addPrivileges(privilege); +} + } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_manifest_file.h b/src/jobs/widget_install/task_manifest_file.h index 98548cb..0cdbe61 100644 --- a/src/jobs/widget_install/task_manifest_file.h +++ b/src/jobs/widget_install/task_manifest_file.h @@ -100,6 +100,7 @@ class TaskManifestFile : void setAppCategory(UiApplication & uiApp); void setLiveBoxInfo(Manifest& manifest); void setAccount(Manifest& uiApp); + void setPrivilege(Manifest& manifest); void generateWidgetName(Manifest & manifest, UiApplication &uiApp,