Merge "Add to read a custum feature key." into tizen_2.2
authorHokwon Song <hokwon.song@samsung.com>
Thu, 31 Oct 2013 07:05:49 +0000 (07:05 +0000)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 31 Oct 2013 07:05:49 +0000 (07:05 +0000)
inc/FAppAppControl.h
inc/FAppMapDataControl.h
inc/FAppSqlDataControl.h
src/app/FAppAppControl.cpp
src/app/FAppMapDataControl.cpp
src/app/FAppSqlDataControl.cpp
src/security/inc/FSec_AccessControlTypes.h

index cd11400..80ede82 100644 (file)
@@ -1053,7 +1053,7 @@ _OSP_EXPORT_ extern const Tizen::Base::String APPCONTROL_RESULT_TERMINATED;
 *              String telUri = L"tel:12345678900";
 *
 *              AppControl* pAc = AppManager::FindAppControlN(L"tizen.phone", L"http://tizen.org/appcontrol/operation/dial");
-*              if(pAc) 
+*              if(pAc)
 *              {
 *                      pAc->Start(&telUri, null, null, null);
 *                      delete pAc;
@@ -1244,9 +1244,12 @@ public:
         * tizen.email, tizen.filemanager, tizen.gallery, tizen.imageviewer, tizen.mmsmessages, and tizen.smsmessages.
         *
         * @since               2.0
+        * @privlevel   public
+        * @privilege   %http://tizen.org/privilege/application.launch
         *
         * @return     An error code
         * @exception  E_SUCCESS                  The method is successful.
+        * @exception  E_PRIVILEGE_DENIED         The application does not have the privilege to call this method.
         * @exception  E_SYSTEM                   A system error has occurred.
         * @exception  E_INVALID_OPERATION        The application control is not permitted to call this method.
         * @remarks     This method is asynchronous.
index f903e22..3b70645 100755 (executable)
@@ -119,6 +119,8 @@ public:
        * the IMapDataControlResponseListener::OnMapDataControlGetValueResponseReceived() method is called.
        *
        * @since        2.0
+       * @privlevel    public
+       * @privilege    %http://tizen.org/privilege/datacontrol.consumer
        *
        * @return               An error code
        * @param[in]    dataId                          The string that identifies the specific data, usually a registry section to get from @n
@@ -139,6 +141,7 @@ public:
        * @exception    E_MAX_EXCEEDED          Either of the following conditions has occurred:
        *                                                                       - The total size of the method arguments has exceeded the maximum limit.
        *                                                                       - The number of requests sent have exceeded the maximum limit.
+       * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
        * @exception    E_SYSTEM                        A system error has occurred.
        * @remarks      The total size of the method arguments is under 16KB because a severe system performance degradation may occur for larger messages. @n
        *                       @c E_MAX_EXCEEDED may be returned for messages over 16KB.
@@ -154,6 +157,8 @@ public:
        * the IMapDataControlResponseListener::OnMapDataControlAddValueResponseReceived() method is called.
        *
        * @since        2.0
+       * @privlevel    public
+       * @privilege    %http://tizen.org/privilege/datacontrol.consumer
        *
        * @return               An error code
        * @param[in]    dataId                          The string that identifies the specific data, usually a registry section to add to @n
@@ -169,6 +174,7 @@ public:
        * @exception    E_MAX_EXCEEDED          Either of the following conditions has occurred:
        *                                                                       - The total size of the method arguments has exceeded the maximum limit.
        *                                                                       - The number of requests sent have exceeded the maximum limit.
+       * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
        * @exception    E_SYSTEM                        A system error has occurred.
        * @remarks      The total size of the method arguments is under 16KB because a severe system performance degradation may occur for larger messages. @n
        *                       @c E_MAX_EXCEEDED may be returned for messages over 16KB.
@@ -185,6 +191,8 @@ public:
        * the IMapDataControlResponseListener::OnMapDataControlSetValueResponseReceived() method is called.
        *
        * @since        2.0
+       * @privlevel    public
+       * @privilege    %http://tizen.org/privilege/datacontrol.consumer
        *
        * @return               An error code
        * @param[in]    dataId                          The string that identifies the specific data, usually a registry section to update @n
@@ -201,6 +209,7 @@ public:
        * @exception    E_MAX_EXCEEDED          Either of the following conditions has occurred:
        *                                                                       - The total size of the method arguments has exceeded the maximum limit.
        *                                                                       - The number of requests sent have exceeded the maximum limit.
+       * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
        * @exception    E_SYSTEM                        A system error has occurred.
        * @remarks      The total size of the method arguments is under 16KB because a severe system performance degradation may occur for larger messages. @n
        *                       @c E_MAX_EXCEEDED may be returned for messages over 16KB.
@@ -216,6 +225,8 @@ public:
        * the IMapDataControlResponseListener::OnMapDataControlRemoveValueResponseReceived() method is called.
        *
        * @since        2.0
+       * @privlevel    public
+       * @privilege    %http://tizen.org/privilege/datacontrol.consumer
        *
        * @return               An error code
        * @param[in]    dataId                          The string that identifies the specific data, usually a registry section to remove from @n
@@ -231,6 +242,7 @@ public:
        * @exception    E_MAX_EXCEEDED          Either of the following conditions has occurred:
        *                                                                       - The total size of the method arguments has exceeded the maximum limit.
        *                                                                       - The number of requests sent have exceeded the maximum limit.
+       * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
        * @exception    E_SYSTEM                        A system error has occurred.
        * @remarks      The total size of the method arguments is under 16KB because a severe system performance degradation may occur for larger messages. @n
        *                       @c E_MAX_EXCEEDED may be returned for messages over 16KB.
index b792a50..a6acf0b 100755 (executable)
@@ -130,6 +130,8 @@ public:
        * the ISqlDataControlResponseListener::OnSqlDataControlSelectResponseReceived() method is called.
        *
        * @since        2.0
+       * @privlevel    public
+       * @privilege    %http://tizen.org/privilege/datacontrol.consumer
        *
        * @return               An error code
        * @param[in]    dataId                          The string that identifies the specific data, usually a database table to query from @n
@@ -162,6 +164,7 @@ public:
        * @exception    E_MAX_EXCEEDED          Either of the following conditions has occurred:
        *                                                                       - The size of the sending buffer has exceeded the maximum limit.
        *                                                                       - The number of sending requests have exceeded the maximum limit.
+       * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
        * @exception    E_SYSTEM                        A system error has occurred.
        * @remarks      The recommended data size is under 16KB because a severe system performance degradation may occur for larger messages. @n
        *                       @c E_MAX_EXCEEDED may be returned for messages over 16KB.
@@ -179,6 +182,8 @@ public:
        * the ISqlDataControlResponseListener::OnSqlDataControlInsertResponseReceived() method is called.
        *
        * @since        2.0
+       * @privlevel    public
+       * @privilege    %http://tizen.org/privilege/datacontrol.consumer
        *
        * @return               An error code
        * @param[in]    dataId                          The string that identifies the specific data, usually a database table to insert into @n
@@ -198,6 +203,7 @@ public:
        * @exception    E_MAX_EXCEEDED          Either of the following conditions has occurred:
        *                                                                       - The size of the sending buffer has exceeded the maximum limit.
        *                                                                       - The number of sending requests have exceeded the maximum limit.
+       * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
        * @exception    E_SYSTEM                        A system error has occurred.
        * @remarks      The recommended data size is under 1MB because a severe system performance degradation may occur for larger messages. @n
        *                       @c E_MAX_EXCEEDED may be returned for messages over 1MB.
@@ -213,6 +219,8 @@ public:
        * the ISqlDataControlResponseListener::OnSqlDataControlUpdateResponseReceived() method is called.
        *
        * @since        2.0
+       * @privlevel    public
+       * @privilege    %http://tizen.org/privilege/datacontrol.consumer
        *
        * @return               An error code
        * @param[in]    dataId                          The string that identifies the specific data, usually a database table to update @n
@@ -238,6 +246,7 @@ public:
        * @exception    E_MAX_EXCEEDED          Either of the following conditions has occurred:
        *                                                                       - The size of the sending buffer has exceeded the maximum limit.
        *                                                                       - The number of sending requests have exceeded the maximum limit.
+       * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
        * @exception    E_SYSTEM                        A system error has occurred.
        * @remarks      The recommended data size is under 1MB because a severe system performance degradation may occur for larger messages. @n
        *                       @c E_MAX_EXCEEDED may be returned for messages over 1MB.
@@ -254,6 +263,8 @@ public:
        * the ISqlDataControlResponseListener::OnSqlDataControlDeleteResponseReceived() method is called.
        *
        * @since        2.0
+       * @privlevel    public
+       * @privilege    %http://tizen.org/privilege/datacontrol.consumer
        *
        * @return               An error code
        * @param[in]    dataId                          The string that identifies the specific data, usually a database table to delete from @n
@@ -275,6 +286,7 @@ public:
        * @exception    E_MAX_EXCEEDED          Either of the following conditions has occurred:
        *                                                                       - The size of the sending buffer has exceeded the maximum limit.
        *                                                                       - The number of sending requests have exceeded the maximum limit.
+       * @exception    E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
        * @exception    E_SYSTEM                        A system error has occurred.
        * @remarks      The recommended data size is under 16KB because a severe system performance degradation may occur for larger messages. @n
        *                       @c E_MAX_EXCEEDED may be returned for messages over 16KB.
index c5d3893..447d748 100644 (file)
@@ -90,6 +90,9 @@ AppControl::FindAndStart(const String& operationId, const String* pUriPattern, c
 result
 AppControl::Stop(void)
 {
+       result r = _AccessController::CheckUserPrivilege(_PRV_APPLICATION_LAUNCH);
+       SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
        SysAssertf(__pAppControlImpl != null, "Instance is not constructed properly.");
        return __pAppControlImpl->Stop();
 }
index 0a6e942..82035d5 100644 (file)
 #include <FBase_NativeError.h>
 
 #include "FApp_MapDataControlImpl.h"
+#include <FSec_AccessController.h>
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::App;
+using namespace Tizen::Security;
 
 namespace Tizen { namespace App {
 
@@ -47,6 +49,9 @@ result
 MapDataControl::GetValue(const String& dataId, const String& key,
                RequestId& reqId, int pageNo, int countPerPage)
 {
+       result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
+       SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
        SysTryReturnResult(NID_APP, __pMapDataControlImpl, E_INVALID_STATE,
                        "This instance has not been properly constructed yet.");
 
@@ -57,6 +62,9 @@ result
 MapDataControl::AddValue(const String& dataId, const String& key,
                const String& value, RequestId& reqId)
 {
+       result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
+       SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
        SysTryReturnResult(NID_APP, __pMapDataControlImpl, E_INVALID_STATE,
                        "This instance has not been properly constructed yet.");
 
@@ -67,6 +75,9 @@ result
 MapDataControl::SetValue(const String& dataId, const String& key,
                const String& oldValue, const String& newValue, RequestId& reqId)
 {
+       result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
+       SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
        SysTryReturnResult(NID_APP, __pMapDataControlImpl, E_INVALID_STATE,
                        "This instance has not been properly constructed yet.");
 
@@ -77,6 +88,9 @@ result
 MapDataControl::RemoveValue(const String& dataId, const String& key,
                const String& value, RequestId& reqId)
 {
+       result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
+       SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
        SysTryReturnResult(NID_APP, __pMapDataControlImpl, E_INVALID_STATE,
                        "This instance has not been properly constructed yet.");
 
index a512047..66cb727 100644 (file)
 #include <FBase_NativeError.h>
 
 #include "FApp_SqlDataControlImpl.h"
+#include <FSec_AccessController.h>
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
+using namespace Tizen::Security;
 
 namespace Tizen { namespace App
 {
@@ -47,6 +49,9 @@ result
 SqlDataControl::Select(const String& dataId, const IList* pColumnList, const String* pWhere,
                const String *pOrder, RequestId& reqId, int pageNo, int countPerPage)
 {
+       result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
+       SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
        SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE,
                        "This instance has not been properly constructed.");
 
@@ -57,6 +62,9 @@ result
 SqlDataControl::Insert(const Tizen::Base::String& dataId, const Tizen::Base::Collection::IMap& insertMap,
                RequestId& reqId)
 {
+       result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
+       SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
        SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE,
                        "This instance has not been properly constructed.");
 
@@ -67,6 +75,9 @@ result
 SqlDataControl::Update(const Tizen::Base::String& dataId, const Tizen::Base::Collection::IMap& updateMap,
                        const Tizen::Base::String* pWhere, RequestId& reqId)
 {
+       result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
+       SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
        SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE, "This instance has not been properly constructed.");
 
        return __pSqlDataControlImpl->Update(dataId, updateMap, pWhere, reqId);
@@ -75,6 +86,9 @@ SqlDataControl::Update(const Tizen::Base::String& dataId, const Tizen::Base::Col
 result
 SqlDataControl::Delete(const Tizen::Base::String& dataId, const Tizen::Base::String* pWhere, RequestId& reqId)
 {
+       result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
+       SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
        SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE,
                        "This instance has not been properly constructed.");
 
index 61119fe..e023abb 100644 (file)
@@ -425,7 +425,7 @@ const static Tizen::Base::_ApiVisibility visibilityLevelListTable[_MAX_PRIVILEGE
        Tizen::Base::_API_VISIBILITY_PLATFORM,  // settingmanager.read
        Tizen::Base::_API_VISIBILITY_PLATFORM,  // settingmanager.write
        Tizen::Base::_API_VISIBILITY_PARTNER,   // appmanager.certificate
-       Tizen::Base::_API_VISIBILITY_PARTNER,   // datacontrol.consumer
+       Tizen::Base::_API_VISIBILITY_PUBLIC,    // datacontrol.consumer
        Tizen::Base::_API_VISIBILITY_PUBLIC,    // datasync
        Tizen::Base::_API_VISIBILITY_PUBLIC,    // filesystem.read
        Tizen::Base::_API_VISIBILITY_PUBLIC,    // filesystem.write