summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyunho Kang <hhstark.kang@samsung.com>2017-07-17 18:33:40 +0900
committerHyunho Kang <hhstark.kang@samsung.com>2017-07-17 10:40:46 +0000
commitc41270dcb0a67a01719a1a25cc8f5ec80fedcd1d (patch)
treedf38a9c0e657fb5003dfb3f856981d42d799289c
parent488438e706f0fd5696a2e2ca263b5dc6a82e8a1a (diff)
downloadwidget-service-c41270dcb0a67a01719a1a25cc8f5ec80fedcd1d.tar.gz
widget-service-c41270dcb0a67a01719a1a25cc8f5ec80fedcd1d.tar.bz2
widget-service-c41270dcb0a67a01719a1a25cc8f5ec80fedcd1d.zip
If root user try to get widget list, it returns duplicate widget list Change-Id: I63197d2ecccf102610e3afd8888d2d823fdc4476 Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
-rw-r--r--src/widget_service.c44
1 files changed, 28 insertions, 16 deletions
diff --git a/src/widget_service.c b/src/widget_service.c
index da15ede..2ebf6df 100644
--- a/src/widget_service.c
+++ b/src/widget_service.c
@@ -781,7 +781,7 @@ EAPI int widget_service_get_widget_list(widget_list_cb cb, void *data)
return WIDGET_ERROR_PERMISSION_DENIED;
ret = _get_widget_list(NULL, getuid(), &list);
- if (ret == WIDGET_ERROR_NONE)
+ if (ret == WIDGET_ERROR_NONE && !_is_global(getuid()))
ret = _get_widget_list(NULL, GLOBALAPP_USER, &list);
for (tmp = list; tmp; tmp = tmp->next) {
@@ -823,7 +823,7 @@ EAPI int widget_service_get_widget_list_by_pkgid(const char *pkgid,
return WIDGET_ERROR_PERMISSION_DENIED;
ret = _get_widget_list(pkgid, getuid(), &list);
- if (ret == WIDGET_ERROR_NONE)
+ if (ret == WIDGET_ERROR_NONE && !_is_global(getuid()))
ret = _get_widget_list(pkgid, GLOBALAPP_USER, &list);
for (tmp = list; tmp; tmp = tmp->next) {
@@ -931,7 +931,8 @@ EAPI char *widget_service_get_main_app_id(const char *widget_id)
}
appid = _get_main_app_id(widget_id, getuid());
- if (appid == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST)
+ if (appid == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST
+ && !_is_global(getuid()))
appid = _get_main_app_id(widget_id, GLOBALAPP_USER);
return appid;
@@ -961,7 +962,7 @@ EAPI int widget_service_get_supported_size_types(const char *widget_id,
ret = _get_widget_supported_info(widget_id, getuid(), cnt,
&width, &height, types);
- if (ret == WIDGET_ERROR_NOT_EXIST)
+ if (ret == WIDGET_ERROR_NOT_EXIST && !_is_global(getuid()))
ret = _get_widget_supported_info(widget_id, GLOBALAPP_USER,
cnt, &width, &height, types);
@@ -1050,7 +1051,8 @@ EAPI char *widget_service_get_app_id_of_setup_app(const char *widget_id)
}
appid = _get_app_id_of_setup_app(widget_id, getuid());
- if (appid == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST)
+ if (appid == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST
+ && !_is_global(getuid()))
appid = _get_app_id_of_setup_app(widget_id, GLOBALAPP_USER);
return appid;
@@ -1125,7 +1127,8 @@ EAPI int widget_service_get_nodisplay(const char *widget_id)
}
nodisplay = _get_nodisplay(widget_id, getuid());
- if (get_last_result() == WIDGET_ERROR_NOT_EXIST)
+ if (get_last_result() == WIDGET_ERROR_NOT_EXIST
+ && !_is_global(getuid()))
nodisplay = _get_nodisplay(widget_id, GLOBALAPP_USER);
return nodisplay;
@@ -1326,7 +1329,8 @@ EAPI char *widget_service_get_preview_image_path(const char *widget_id,
_convert_type_to_support_size_ratio(size_type, &w, &h);
path = _get_preview_image_path(widget_id, w, h, getuid());
- if (path == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST)
+ if (path == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST
+ && !_is_global(getuid()))
path = _get_preview_image_path(widget_id, w, h, GLOBALAPP_USER);
if (path == NULL) {
@@ -1501,11 +1505,13 @@ EAPI char *widget_service_get_icon(const char *pkgid, const char *lang)
}
widget_id = _get_main_widget_id(pkgid, getuid());
- if (widget_id == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST)
+ if (widget_id == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST
+ && !_is_global(getuid()))
widget_id = _get_main_widget_id(pkgid, GLOBALAPP_USER);
icon = _get_icon(widget_id, lang, getuid());
- if (icon == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST)
+ if (icon == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST
+ && !_is_global(getuid()))
icon = _get_icon(widget_id, lang, GLOBALAPP_USER);
return icon;
@@ -1631,7 +1637,8 @@ EAPI char *widget_service_get_name(const char *widget_id, const char *lang)
}
name = _get_name(widget_id, language, getuid());
- if (name == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST)
+ if (name == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST
+ && !_is_global(getuid()))
name = _get_name(widget_id, language, GLOBALAPP_USER);
free(language);
@@ -1658,7 +1665,8 @@ EAPI int widget_service_get_supported_sizes(const char *widget_id, int *cnt,
return WIDGET_ERROR_PERMISSION_DENIED;
ret = _get_widget_supported_sizes(widget_id, getuid(), cnt, w, h);
- if (ret == WIDGET_ERROR_NOT_EXIST)
+ if (ret == WIDGET_ERROR_NOT_EXIST
+ && !_is_global(getuid()))
ret = _get_widget_supported_sizes(widget_id, GLOBALAPP_USER,
cnt, w, h);
@@ -1760,7 +1768,8 @@ static char *__get_widget_main_appid_from_pkgid_or_appid(const char *id)
}
ret = _get_widget_list(id, getuid(), &widget_list);
- if (ret != WIDGET_ERROR_NONE || widget_list == NULL)
+ if ((ret != WIDGET_ERROR_NONE || widget_list == NULL)
+ && !_is_global(getuid()))
ret = _get_widget_list(id, GLOBALAPP_USER, &widget_list);
if (widget_list == NULL)
@@ -1818,7 +1827,8 @@ EAPI char *widget_service_get_widget_id(const char *appid)
}
classid = _get_widget_id(appid, getuid());
- if (classid == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST)
+ if (classid == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST
+ && !_is_global(getuid()))
classid = _get_widget_id(appid, GLOBALAPP_USER);
if (classid)
@@ -1833,7 +1843,8 @@ EAPI char *widget_service_get_widget_id(const char *appid)
}
classid = _get_widget_id(widget_id, getuid());
- if (classid == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST)
+ if (classid == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST
+ && !_is_global(getuid()))
classid = _get_widget_id(widget_id, GLOBALAPP_USER);
free(widget_id);
@@ -1911,7 +1922,8 @@ EAPI char *widget_service_get_package_id(const char *widget_id)
}
pkgid = _get_package_id(widget_id, getuid());
- if (pkgid == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST)
+ if (pkgid == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST
+ && !_is_global(getuid()))
pkgid = _get_package_id(widget_id, GLOBALAPP_USER);
return pkgid;
@@ -2215,7 +2227,7 @@ EAPI int widget_service_get_widget_max_count(const char *widget_id)
return WIDGET_ERROR_PERMISSION_DENIED;
ret = __get_max_instance(widget_id, getuid());
- if (ret == WIDGET_ERROR_NOT_EXIST)
+ if (ret == WIDGET_ERROR_NOT_EXIST && !_is_global(getuid()))
ret = __get_max_instance(widget_id, GLOBALAPP_USER);
return ret;