From a4fd76db1e966bf09b1a3cb6c4a7e150cf6bfa53 Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Fri, 14 Dec 2012 10:38:54 +0900 Subject: [PATCH] [Release] wrt-commons_0.2.80 Change-Id: I3ace2eb10ec8b429717c397cb28d41e7a1b48f57 --- debian/changelog | 9 ++++++ modules/widget_dao/dao/config_parser_data.cpp | 30 +++++++++++++++++++ modules/widget_dao/dao/widget_dao.cpp | 18 +++++++++++ .../dpl/wrt-dao-ro/config_parser_data.h | 17 +++++++++++ .../include/dpl/wrt-dao-rw/widget_dao.h | 3 ++ modules/widget_dao/orm/wrt_db | 10 ++++++- packaging/wrt-commons.spec | 4 +-- 7 files changed, 88 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 215553f..f1c63cf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +wrt-commons (0.2.80) unstable; urgency=low + + * Implement privilege database table + + * Git : framework/web/wrt-commons + * Tag : wrt-commons_0.2.80 + + -- Jihoon Chung Fri, 14 Dec 2012 10:30:48 +0900 + wrt-commons (0.2.79) unstable; urgency=low * Replacing DbWidgetHandle with WidgetPkgName in SecurityOriginDAO diff --git a/modules/widget_dao/dao/config_parser_data.cpp b/modules/widget_dao/dao/config_parser_data.cpp index 4d0968b..9e2e2a4 100644 --- a/modules/widget_dao/dao/config_parser_data.cpp +++ b/modules/widget_dao/dao/config_parser_data.cpp @@ -299,6 +299,36 @@ bool ConfigParserData::Feature::operator<=(const Feature& other) const return paramsList <= other.paramsList; } +bool ConfigParserData::Privilege::operator==(const Privilege& other) const +{ + return name == other.name; +} + +bool ConfigParserData::Privilege::operator!=(const Privilege& other) const +{ + return name != other.name; +} + +bool ConfigParserData::Privilege::operator >(const Privilege& other) const +{ + return name > other.name; +} + +bool ConfigParserData::Privilege::operator>=(const Privilege& other) const +{ + return name >= other.name; +} + +bool ConfigParserData::Privilege::operator <(const Privilege& other) const +{ + return name < other.name; +} + +bool ConfigParserData::Privilege::operator<=(const Privilege& other) const +{ + return name < other.name; +} + bool ConfigParserData::Icon::operator==(const Icon& other) const { return src == other.src; diff --git a/modules/widget_dao/dao/widget_dao.cpp b/modules/widget_dao/dao/widget_dao.cpp index db2e682..5f8ca9b 100644 --- a/modules/widget_dao/dao/widget_dao.cpp +++ b/modules/widget_dao/dao/widget_dao.cpp @@ -338,6 +338,8 @@ void WidgetDAO::registerWidgetInternal( registerWidgetFeatures(widgetHandle, widgetRegInfo); + registerWidgetPrivilege(widgetHandle, widgetRegInfo); + registerWidgetWindowModes(widgetHandle, widgetRegInfo); registerWidgetWarpInfo(widgetHandle, widgetRegInfo); @@ -629,6 +631,22 @@ void WidgetDAO::registerWidgetFeatures(DbWidgetHandle widgetHandle, } } +void WidgetDAO::registerWidgetPrivilege(DbWidgetHandle widgetHandle, + const WidgetRegisterInfo ®Info) +{ + using namespace DPL::DB::ORM; + const ConfigParserData& widgetConfigurationInfo = regInfo.configInfo; + + FOREACH(it, widgetConfigurationInfo.privilegeList) + { + wrt::WidgetPrivilege::Row widgetPrivilege; + widgetPrivilege.Set_app_id(widgetHandle); + widgetPrivilege.Set_name(it->name); + + DO_INSERT(widgetPrivilege, wrt::WidgetPrivilege) + } +} + void WidgetDAO::updateFeatureRejectStatus(const DbWidgetFeature &widgetFeature){ // This function could be merged with registerWidgetFeature but it requires desing change: // 1. Check "ace step" in installer must be done before "update database step" diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h index f82ea01..918ae0d 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h @@ -77,6 +77,22 @@ class ConfigParserData }; typedef std::set FeaturesList; + struct Privilege + { + Privilege(const DPL::String& _name) : name(_name) + { + } + DPL::String name; + + bool operator==(const Privilege&) const; + bool operator!=(const Privilege&) const; + bool operator >(const Privilege&) const; + bool operator>=(const Privilege&) const; + bool operator <(const Privilege&) const; + bool operator<=(const Privilege&) const; + }; + typedef std::set PrivilegeList; + struct Icon { Icon(const DPL::String& _src) : src(_src) @@ -202,6 +218,7 @@ class ConfigParserData DPL::OptionalString authorEmail; FeaturesList featuresList; + PrivilegeList privilegeList; SettingsList settingsList; diff --git a/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h b/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h index e6776d8..3f7b819 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h +++ b/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h @@ -175,6 +175,9 @@ class WidgetDAO : public WidgetDAOReadOnly static void registerWidgetFeatures( DbWidgetHandle widgetHandle, const WidgetRegisterInfo ®Info); + static void registerWidgetPrivilege( + DbWidgetHandle widgetHandle, + const WidgetRegisterInfo ®Info); static void registerWidgetWindowModes( DbWidgetHandle widgetHandle, const WidgetRegisterInfo ®Info); diff --git a/modules/widget_dao/orm/wrt_db b/modules/widget_dao/orm/wrt_db index 9f35e25..06c12bc 100644 --- a/modules/widget_dao/orm/wrt_db +++ b/modules/widget_dao/orm/wrt_db @@ -124,12 +124,20 @@ CREATE_TABLE(FeatureParam) COLUMN_NOT_NULL(widget_feature_id, INTEGER,) COLUMN_NOT_NULL(name, TEXT,) COLUMN_NOT_NULL(value, TEXT,) - TABLE_CONSTRAINTS( FOREIGN KEY (widget_feature_id) REFERENCES WidgetFeature (widget_feature_id) ON DELETE CASCADE ) CREATE_TABLE_END() +CREATE_TABLE(WidgetPrivilege) + COLUMN_NOT_NULL(widget_privilege_id, INTEGER, primary key autoincrement) + COLUMN_NOT_NULL(app_id, INT,) + COLUMN_NOT_NULL(name, VARCHAR(256),) + TABLE_CONSTRAINTS( + FOREIGN KEY (app_id) REFERENCES WidgetInfo (app_id) ON DELETE CASCADE + ) +CREATE_TABLE_END() + CREATE_TABLE(WidgetIcon) COLUMN_NOT_NULL(icon_id, INTEGER, primary key autoincrement) COLUMN_NOT_NULL(app_id, INT,) diff --git a/packaging/wrt-commons.spec b/packaging/wrt-commons.spec index 5bd9057..fd89e00 100644 --- a/packaging/wrt-commons.spec +++ b/packaging/wrt-commons.spec @@ -1,7 +1,7 @@ -#git:framework/web/wrt-commons wrt-commons 0.2.79 +#git:framework/web/wrt-commons wrt-commons 0.2.80 Name: wrt-commons Summary: Wrt common library -Version: 0.2.79 +Version: 0.2.80 Release: 1 Group: Development/Libraries License: Apache License, Version 2.0 -- 2.34.1