major version up : apply multi-user(System) 09/48709/1 accepted/tizen/3.0/ivi/20161011.053518 accepted/tizen/ivi/20160218.022858 accepted/tizen/mobile/20151006.225113 accepted/tizen/tv/20151103.024921 accepted/tizen/wearable/20151203.083943 submit/tizen_3.0_ivi/20161010.000010 submit/tizen_common/20151229.142028 submit/tizen_common/20151229.144031 submit/tizen_common/20151229.154718 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000001 submit/tizen_mobile/20151006.082543 submit/tizen_tv/20151103.020006 submit/tizen_wearable/20151203.073504 tizen_3.0.m2.a1_mobile_release
authorjang <jiseob.jang@samsung.com>
Fri, 25 Sep 2015 07:35:40 +0000 (16:35 +0900)
committerjang <jiseob.jang@samsung.com>
Fri, 25 Sep 2015 07:35:40 +0000 (16:35 +0900)
- modify for supporting both user and global app.

Change-Id: I8d35e9691737cc3fc64b8e06df3234f0305b1dfb
Signed-off-by: jang <jiseob.jang@samsung.com>
packaging/account-parser.spec
src/account.c

index e1eae81..79c9192 100644 (file)
@@ -1,6 +1,6 @@
 Name:          account-parser
 Summary:       Account Parser Library
-Version:       0.0.13
+Version:       0.1.0
 Release:       0
 Group:         Social & Content/Other
 License:       Apache-2.0
index 9beb6b5..d1576b4 100644 (file)
@@ -445,7 +445,9 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id)
        // Insert the account type to the account DB
        {
                int account_type_db_id = 0;
-               if (getuid() == 0) {
+               uid_t uid = -1;
+               uid = getuid();
+               if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
                        ret = account_type_insert_to_db_offline(account_type_handle, &account_type_db_id);
                } else {
                        ret = account_type_insert_to_db(account_type_handle, &account_type_db_id);
@@ -482,14 +484,21 @@ int _unregister_account_provider(pkgmgrinfo_appinfo_h package_info_handle, void*
        _D("appid : %s", app_id);
 
        int ret = ACCOUNT_ERROR_NONE;
+       uid_t uid = -1;
+       uid = getuid();
 
-       ret = account_delete_from_db_by_package_name_offline((char*)app_id);
+       //To Do : delete accounts of this app from all user db.
+       if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
+               ret = account_delete_from_db_by_package_name_offline((char*)app_id);
+       }else {
+               ret = account_delete_from_db_by_package_name((char*)app_id);
+       }
        if((ret != ACCOUNT_ERROR_NONE) && (ret !=  ACCOUNT_ERROR_RECORD_NOT_FOUND)) {
                _E("Failed to perform account_delete_from_db_by_package_name_offline().");
                goto CATCH;
        }
 
-       if (getuid() == 0) {
+       if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
                ret = account_type_delete_by_app_id_offline((char*)app_id);
        } else {
                ret = account_type_delete_by_app_id((char*)app_id);
@@ -513,10 +522,12 @@ int _on_package_app_list_received_cb(pkgmgrinfo_appinfo_h handle, void *user_dat
 
        int ret = ACCOUNT_ERROR_NONE;
        char* app_id = NULL;
+       uid_t uid = -1;
        pkgmgrinfo_appinfo_get_appid(handle, &app_id);
        _D("appid : %s", app_id);
 
-       if (getuid() == 0) {
+       uid = getuid();
+       if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
                ret = account_type_delete_by_app_id_offline((char*)app_id);
        } else {
                ret = account_type_delete_by_app_id((char*)app_id);