Add the E_USER_NOT_CONSENTED exception in account apis
authorYoonchan Choi <yc81.choi@samsung.com>
Thu, 11 Apr 2013 10:36:47 +0000 (19:36 +0900)
committerYoonchan Choi <yc81.choi@samsung.com>
Thu, 11 Apr 2013 10:36:47 +0000 (19:36 +0900)
Change-Id: I42abda68c0635d07bbcff436ea5630fdf72f1954
Signed-off-by: Yoonchan Choi <yc81.choi@samsung.com>
inc/FSclAccountAccessor.h
inc/FSclAccountManager.h
src/FSclAccountAccessor.cpp
src/FSclAccountManager.cpp

index cbc0092..c438914 100644 (file)
@@ -66,10 +66,11 @@ public:
         * @privilege   %http://tizen.org/privilege/account.read
         *
         * @return              An error code
-        * @param[in]   pListener                       The event listener
-        * @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                        The method cannot proceed due to a severe system error.
+        * @param[in]   pListener                               The event listener
+        * @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                                The method cannot proceed due to a severe system error.
+        * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
         * @remarks             The platform will not take the ownership of @c pListener after this call.
         */
        result SetEventListener(IAccountEventListener* pListener);
@@ -82,12 +83,13 @@ public:
         * @privilege   %http://tizen.org/privilege/account.read
         *
         * @return              An account with the specified @c accountId
-        * @param[in]   accountId                       The account ID
-        * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
-        * @exception   E_INVALID_ARG           The specified @c accountId is invalid.
-        * @exception   E_OBJ_NOT_FOUND         The specified @c accountId is not found.
-        * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
+        * @param[in]   accountId                               The account ID
+        * @exception   E_SUCCESS                               The method is successful.
+        * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
+        * @exception   E_INVALID_ARG                   The specified @c accountId is invalid.
+        * @exception   E_OBJ_NOT_FOUND                 The specified @c accountId is not found.
+        * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
+        * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
         * @remarks             The specific error code can be accessed using the GetLastResult() method.
         */
        Account GetAccount(AccountId accountId) const;
@@ -105,6 +107,7 @@ public:
         * @exception   E_SUCCESS                               The method is successful.
         * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
         * @exception   E_INVALID_ARG                   The specified @c accountProviderAppId is empty.
+        * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
         * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
         * @remarks             The specific error code can be accessed using the GetLastResult() method.
         */
@@ -119,9 +122,10 @@ public:
         *
         * @return              A list of accounts, @n
         *                                      else an empty list if there is no account, or @c null if an exception occurs (@ref Account list)
-        * @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                        The method cannot proceed due to a severe system error.
+        * @exception   E_SUCCESS                               The method is successful.
+        * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
+        * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
+        * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
         * @remarks             The specific error code can be accessed using the GetLastResult() method.
         */
        Tizen::Base::Collection::IList* GetAllAccountsN(void) const;
@@ -139,6 +143,7 @@ public:
         * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
         * @exception   E_INVALID_ARG                   The specified @c accountProviderAppId is empty.
         * @exception   E_OBJ_NOT_FOUND                 The specified @c accountProviderAppId is not found.
+        * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
         * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
         * @remarks             The specific error code can be accessed using the GetLastResult() method.
         */
@@ -153,11 +158,12 @@ public:
         *
         * @return              A list of account providers, @n
         *                                      else an empty list if there is no account provider, or @c null if an exception occurs (@ref AccountProvider list)
-        * @param[in]   capability                      The predefined capability or the vendor-specific capability defined as the IRI format
-        * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
-        * @exception   E_INVALID_ARG           The specified @c capability is empty.
-        * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
+        * @param[in]   capability                              The predefined capability or the vendor-specific capability defined as the IRI format
+        * @exception   E_SUCCESS                               The method is successful.
+        * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
+        * @exception   E_INVALID_ARG                   The specified @c capability is empty.
+        * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
+        * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
         * @remarks             The specific error code can be accessed using the GetLastResult() method.
         */
        Tizen::Base::Collection::IList* GetAccountProvidersByCapabilityN(const Tizen::Base::String& capability) const;
@@ -171,9 +177,10 @@ public:
         *
         * @return              A list of account providers, @n
         *                                      else an empty list if there is no account provider, or @c null if an exception occurs (@ref AccountProvider list)
-        * @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                        The method cannot proceed due to a severe system error.
+        * @exception   E_SUCCESS                               The method is successful.
+        * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
+        * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
+        * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
         * @remarks             The specific error code can be accessed using the GetLastResult() method.
         */
        Tizen::Base::Collection::IList* GetAllAccountProvidersN(void) const;
index 4ee5018..118780b 100644 (file)
@@ -66,16 +66,17 @@ public:
         * @privilege   %http://tizen.org/privilege/account.write
         *
         * @return                      An error code
-        * @param[in,out]       account                         The account to add
-        * @exception           E_SUCCESS                       The method is successful.
-        * @exception           E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
-        * @exception           E_INVALID_ARG           Either of the following conditions has occurred: @n
-        *                                                                              - The user name is an empty string in the specified @c account. @n
-        *                                                                              - The account ID is not #INVALID_ACCOUNT_ID. @n
-        * @exception           E_INVALID_OPERATION     Either of the following conditions has occurred: @n
-        *                                                                              - The caller application does not belong to a package of an application that registers its own account provider. @n
-        *                                                                              - The account has already been added with the multiple accounts support set to @c false.
-        * @exception           E_SYSTEM                        The method cannot proceed due to a severe system error.
+        * @param[in,out]       account                                 The account to add
+        * @exception           E_SUCCESS                               The method is successful.
+        * @exception           E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
+        * @exception           E_INVALID_ARG                   Either of the following conditions has occurred: @n
+        *                                                                                      - The user name is an empty string in the specified @c account. @n
+        *                                                                                      - The account ID is not #INVALID_ACCOUNT_ID. @n
+        * @exception           E_INVALID_OPERATION             Either of the following conditions has occurred: @n
+        *                                                                                      - The caller application does not belong to a package of an application that registers its own account provider. @n
+        *                                                                                      - The account has already been added with the multiple accounts support set to @c false.
+        * @exception           E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
+        * @exception           E_SYSTEM                                The method cannot proceed due to a severe system error.
         */
        result AddAccount(Account& account);
 
@@ -88,13 +89,14 @@ public:
         * @privilege   %http://tizen.org/privilege/account.write
         *
         * @return              An error code
-        * @param[in]   accountId                       The account ID
-        * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
-        * @exception   E_INVALID_ARG           The specified @c accountId is invalid.
-        * @exception   E_OBJ_NOT_FOUND         The specified @c accountId does not exist.
-        * @exception   E_INVALID_OPERATION     This operation is not allowed if the caller application does not belong to a package of an application that registers its own account provider.
-        * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
+        * @param[in]   accountId                               The account ID
+        * @exception   E_SUCCESS                               The method is successful.
+        * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
+        * @exception   E_INVALID_ARG                   The specified @c accountId is invalid.
+        * @exception   E_OBJ_NOT_FOUND                 The specified @c accountId does not exist.
+        * @exception   E_INVALID_OPERATION             This operation is not allowed if the caller application does not belong to a package of an application that registers its own account provider.
+        * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
+        * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
         */
        result RemoveAccount(AccountId accountId);
 
@@ -108,15 +110,16 @@ public:
         * @privilege   %http://tizen.org/privilege/account.write
         *
         * @return              An error code
-        * @param[in]   account                         The account to update
-        * @exception   E_SUCCESS                       The method is successful.
-        * @exception   E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
-        * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
-        *                                                                      - The user name is an empty string in the specified @c account. @n
-        *                                                                      - The account ID is invalid. @n
-        * @exception   E_OBJ_NOT_FOUND         The specified @c account does not exist.
-        * @exception   E_INVALID_OPERATION     This operation is not allowed if the caller application does not belong to a package of an application that registers its own account provider.
-        * @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
+        * @param[in]   account                                 The account to update
+        * @exception   E_SUCCESS                               The method is successful.
+        * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
+        * @exception   E_INVALID_ARG                   Either of the following conditions has occurred: @n
+        *                                                                              - The user name is an empty string in the specified @c account. @n
+        *                                                                              - The account ID is invalid. @n
+        * @exception   E_OBJ_NOT_FOUND                 The specified @c account does not exist.
+        * @exception   E_INVALID_OPERATION             This operation is not allowed if the caller application does not belong to a package of an application that registers its own account provider.
+        * @exception   E_USER_NOT_CONSENTED    The user blocks an application from calling this method.
+        * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
         */
        result UpdateAccount(const Account& account);
 
index b28cd68..cc44903 100644 (file)
@@ -58,12 +58,14 @@ AccountAccessor::~AccountAccessor(void)
 result
 AccountAccessor::SetEventListener(IAccountEventListener* pListener)
 {
-       SysTryReturnResult(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ) == E_SUCCESS, E_PRIVILEGE_DENIED
-               , "The application does not have the privilege to call this method.");
+       result r = _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ);
+       r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+       SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
        SysAssertf(__pAccountAccessorImpl != null,
                        "Not yet constructed. Construct() should be called before use.");
 
-       result r = __pAccountAccessorImpl->SetEventListener(pListener);
+       r = __pAccountAccessorImpl->SetEventListener(pListener);
        SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
@@ -74,8 +76,10 @@ AccountAccessor::GetAccount(AccountId accountId) const
 {
        Account account(L"");
 
-       SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ) == E_SUCCESS, account, E_PRIVILEGE_DENIED
-               , "The application does not have the privilege to call this method.");
+       result r = _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ);
+       r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+       SysTryReturn(NID_SCL, r == E_SUCCESS, account, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
        SysAssertf(__pAccountAccessorImpl != null,
                        "Not yet constructed. Construct() should be called before use.");
 
@@ -88,8 +92,10 @@ AccountAccessor::GetAccount(AccountId accountId) const
 IList*
 AccountAccessor::GetAccountsByAccountProviderN(const AppId& accountProviderAppId) const
 {
-       SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED
-               , "The application does not have the privilege to call this method.");
+       result r = _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ);
+       r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+       SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
        SysAssertf(__pAccountAccessorImpl != null,
                        "Not yet constructed. Construct() should be called before use.");
 
@@ -102,8 +108,10 @@ AccountAccessor::GetAccountsByAccountProviderN(const AppId& accountProviderAppId
 IList*
 AccountAccessor::GetAllAccountsN(void) const
 {
-       SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED
-               , "The application does not have the privilege to call this method.");
+       result r = _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ);
+       r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+       SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
        SysAssertf(__pAccountAccessorImpl != null,
                        "Not yet constructed. Construct() should be called before use.");
 
@@ -118,8 +126,10 @@ AccountAccessor::GetAccountProvider(const AppId& accountProviderAppId) const
 {
        AccountProvider accountProvider;
 
-       SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ) == E_SUCCESS, accountProvider, E_PRIVILEGE_DENIED
-               , "The application does not have the privilege to call this method.");
+       result r = _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ);
+       r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+       SysTryReturn(NID_SCL, r == E_SUCCESS, accountProvider, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
        SysAssertf(__pAccountAccessorImpl != null,
                        "Not yet constructed. Construct() should be called before use.");
 
@@ -132,8 +142,10 @@ AccountAccessor::GetAccountProvider(const AppId& accountProviderAppId) const
 IList*
 AccountAccessor::GetAccountProvidersByCapabilityN(const String& capability) const
 {
-       SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED
-               , "The application does not have the privilege to call this method.");
+       result r = _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ);
+       r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+       SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
        SysAssertf(__pAccountAccessorImpl != null,
                        "Not yet constructed. Construct() should be called before use.");
 
@@ -146,8 +158,10 @@ AccountAccessor::GetAccountProvidersByCapabilityN(const String& capability) cons
 IList*
 AccountAccessor::GetAllAccountProvidersN(void) const
 {
-       SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED
-               , "The application does not have the privilege to call this method.");
+       result r = _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_READ);
+       r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+       SysTryReturn(NID_SCL, r == E_SUCCESS, null, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
        SysAssertf(__pAccountAccessorImpl != null,
                        "Not yet constructed. Construct() should be called before use.");
 
index fab1ddc..ef591dd 100644 (file)
@@ -55,12 +55,14 @@ AccountManager::~AccountManager(void)
 result
 AccountManager::AddAccount(Account& account)
 {
-       SysTryReturnResult(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED
-               , "The application does not have the privilege to call this method.");
+       result r = _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_WRITE);
+       r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+       SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
        SysAssertf(__pAccountManagerImpl != null,
                        "Not yet constructed. Construct() should be called before use.");
 
-       result r = __pAccountManagerImpl->AddAccount(account);
+       r = __pAccountManagerImpl->AddAccount(account);
        SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
@@ -69,12 +71,14 @@ AccountManager::AddAccount(Account& account)
 result
 AccountManager::RemoveAccount(AccountId accountId)
 {
-       SysTryReturnResult(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED
-               , "The application does not have the privilege to call this method.");
+       result r = _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_WRITE);
+       r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+       SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
        SysAssertf(__pAccountManagerImpl != null,
                        "Not yet constructed. Construct() should be called before use.");
 
-       result r = __pAccountManagerImpl->RemoveAccount(accountId);
+       r = __pAccountManagerImpl->RemoveAccount(accountId);
        SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
@@ -83,12 +87,14 @@ AccountManager::RemoveAccount(AccountId accountId)
 result
 AccountManager::UpdateAccount(const Account& account)
 {
-       SysTryReturnResult(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED
-               , "The application does not have the privilege to call this method.");
+       result r = _AccessController::CheckUserPrivilege(_PRV_ACCOUNT_WRITE);
+       r = TransExceptionsExclusive(r, E_PRIVILEGE_DENIED, E_USER_NOT_CONSENTED);
+       SysTryReturn(NID_SCL, r == E_SUCCESS, r, r, "[%s] The application is not permitted to call this method.", GetErrorMessage(r));
+
        SysAssertf(__pAccountManagerImpl != null,
                        "Not yet constructed. Construct() should be called before use.");
 
-       result r = __pAccountManagerImpl->UpdateAccount(account);
+       r = __pAccountManagerImpl->UpdateAccount(account);
        SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;