/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2020 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* @section CAPI_SECURITY_FRAMEWORK_PRIVILEGE_INFO_MODULE_OVERVIEW Overview
* A library for reading privilege information of the given privilege and API issue version.
* It provides the display name or description of privileges.
- * If there's no matching privilege then it shows last token of given privilege or description string for undefined privileges.
+ * If there's no matching privilege then it returns error.
*
* @section CAPI_SECURITY_FRAMEWORK_PRIVILEGE_INFO_MODULE_FEATURE Related Features
* This API is related with the following features:\n
%post -n tc-privilege-info
tpk-backend -y org.tizen.test-privilege-info --preload
-cyad -s -k MANIFESTS -c User::Pkg::org.tizen.test-privilege-info -u '*' -p http://tizen.org/privilege/contact.read -t DENY
+cyad -s -k MANIFESTS_GLOBAL -c User::Pkg::org.tizen.test-privilege-info -u '*' -p http://tizen.org/privilege/contact.read -t DENY
%files -n privilege-info
%{_libdir}/libprivilege-info.so*
/*
- * Copyright (c) 2014-2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2020 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
PRVINFO_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter */
PRVINFO_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
PRVINFO_ERROR_INTERNAL_ERROR = TIZEN_ERROR_UNKNOWN, /**< Unknown error */
- PRVINFO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED /**< Not supported (Since 5.0) */
+ PRVINFO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported (Since 5.0) */
+ PRVINFO_ERROR_NO_MATCHING_PRIVILEGE = TIZEN_ERROR_PRIVILEGE_INFORMATION | 0x01 /**< No matched privilege (Since 6.0) */
} privilege_info_error_e;
* @brief Gets the display name of the given privilege.
* @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
* @remarks @a display_name must be released using free().
+ * @remarks Since 6.0, it will return #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE if the given @a privilege not exist.
* @param[in] api_version The API version of the application to get privilege information
* @param[in] privilege The privilege
* @param[out] display_name The display name of the privilege
* @return @c 0 on success,
* otherwise a negative error value
* @retval #PRVINFO_ERROR_NONE Successful
+ * @retval #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE No matched privilege
* @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
* @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
* @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
* @brief Gets the display name of the given privilege.
* @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
* @remarks @a display_name must be released using free().
- * @remarks package_type must be one of followings: "PRVINFO_PACKAGE_TYPE_NATIVE", "PRVINFO_PACKAGE_TYPE_WEB"
+ * @remarks @a package_type must be one of followings: "PRVINFO_PACKAGE_TYPE_NATIVE", "PRVINFO_PACKAGE_TYPE_WEB"
+ * @remarks Since 6.0, it will return #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE if the given @a privilege not exist.
* @param[in] package_type The type of application package
* @param[in] api_version The API version of the application to get privilege information
* @param[in] privilege The privilege
* @return @c 0 on success,
* otherwise a negative error value
* @retval #PRVINFO_ERROR_NONE Successful
+ * @retval #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE No matched privilege
* @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
* @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
* @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
* @brief Gets the description of the given privilege.
* @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
* @remarks @a description must be released using free().
+ * @remarks Since 6.0, it will return #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE if the given @a privilege not exist.
* @param[in] api_version The API version of the application to get privilege information
* @param[in] privilege The privilege
* @param[out] description The description of the privilege
* @return @c 0 on success,
* otherwise a negative error value
* @retval #PRVINFO_ERROR_NONE Successful
+ * @retval #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE No matched privilege
* @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
* @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
* @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
* @brief Gets the description of the given privilege.
* @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif
* @remarks @a description must be released using free().
- * @remarks package_type must be one of followings: "PRVINFO_PACKAGE_TYPE_NATIVE", "PRVINFO_PACKAGE_TYPE_WEB"
+ * @remarks @a package_type must be one of followings: "PRVINFO_PACKAGE_TYPE_NATIVE", "PRVINFO_PACKAGE_TYPE_WEB"
+ * @remarks Since 6.0, it will return #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE if the given @a privilege not exist.
* @param[in] package_type The type of application package
* @param[in] api_version The API version of the application to get privilege information
* @param[in] privilege The privilege
* @return @c 0 on success,
* otherwise a negative error value
* @retval #PRVINFO_ERROR_NONE Successful
+ * @retval #PRVINFO_ERROR_NO_MATCHING_PRIVILEGE No matched privilege
* @retval #PRVINFO_ERROR_OUT_OF_MEMORY Out of memory
* @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
* @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
/*
- * Copyright (c) 2014-2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2020 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
#define PI_API __attribute__((visibility("default")))
#endif
-typedef enum {
- PRVINFO_ERROR_NO_MATCHING_PRIVILEGE = TIZEN_ERROR_PRIVILEGE_INFORMATION | 0x01
-} privilege_info_internal_error_e;
-
int privilege_info_get_string_id(const char *package_type_string, int display, const char *api_version, const char *privilege, char **string_id)
{
- TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
- TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
-
char* temp = NULL;
int ret;
privilege_manager_package_type_e package_type;
else
ret = privilege_db_manager_get_privilege_description(PRVMGR_PACKAGE_TYPE_CORE, privilege, api_version, &temp);
- if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE)
- goto err_none;
+ if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE && temp != NULL)
+ goto string_id_found;
else if (ret != PRIVILEGE_DB_MANAGER_ERR_NO_EXIST_RESULT)
- goto err_internal_error;
+ goto err;
/* Check WEB */
else
ret = privilege_db_manager_get_privilege_description(package_type, privilege, api_version, &temp);
-
- if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE)
- goto err_none;
- else if (ret == PRIVILEGE_DB_MANAGER_ERR_NO_EXIST_RESULT)
- goto err_no_matching_privilege;
+ if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE && temp != NULL)
+ goto string_id_found;
else
- goto err_internal_error;
+ goto err;
-err_none:
+string_id_found:
*string_id = strdup(temp);
TryReturn(*string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed.");
free(temp);
return PRVINFO_ERROR_NONE;
-err_no_matching_privilege:
+err:
*string_id = NULL;
- free(temp);
- return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
-
-err_internal_error:
- free(temp);
- return PRVINFO_ERROR_INTERNAL_ERROR;
+ if (temp != NULL)
+ free(temp);
+ if (ret == PRIVILEGE_DB_MANAGER_ERR_NO_EXIST_RESULT)
+ return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
+ else
+ return PRVINFO_ERROR_INTERNAL_ERROR;
}
int privilege_info_get_string_by_string_id(const char *string_id, char **string)
{
- char *temp = NULL;
TryReturn(string_id != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] string_id is NULL");
-
+ char* temp = NULL;
temp = dgettext("privilege", string_id);
*string = strdup(temp);
PI_API
int privilege_info_get_display_name(const char *api_version, const char *privilege, char **display_name)
{
- int ret = 0;
- char* string_id = NULL;
-
TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
- ret = privilege_info_get_string_id(NULL, 1, api_version, privilege, &string_id);
-
- if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
- char* tempPrivilege = NULL;
- char* token = NULL;
- char* temp = NULL;
- char* save = NULL;
+ int ret = 0;
+ char* string_id = NULL;
- tempPrivilege = strdup(privilege);
- TryReturn(tempPrivilege != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] tempPrivilege's strdup is failed.");
+ ret = privilege_info_get_string_id(NULL, 1, api_version, privilege, &string_id);
- token = strtok_r(tempPrivilege, "/", &save);
- while (token) {
- temp = token;
- token = strtok_r(NULL, "/", &save);
- }
- TryReturn(temp != NULL, free(tempPrivilege), PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] invalid privilege <%s>", privilege);
- *display_name = strdup(temp);
- TryReturn(*display_name != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- free(tempPrivilege);
- } else if (ret == PRVINFO_ERROR_NONE) {
+ if (ret == PRVINFO_ERROR_NONE)
ret = privilege_info_get_string_by_string_id(string_id, display_name);
+ if (string_id != NULL)
free(string_id);
- TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- } else {
- return PRVINFO_ERROR_INTERNAL_ERROR;
- }
- return PRVINFO_ERROR_NONE;
+ return ret;
}
PI_API
int privilege_info_get_description(const char *api_version, const char *privilege, char **description)
{
- int ret = 0;
- char* string_id = NULL;
-
TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
+ int ret = 0;
+ char* string_id = NULL;
+
ret = privilege_info_get_string_id(NULL, 0, api_version, privilege, &string_id);
- if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
- ret = privilege_info_get_string_by_string_id("IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED", description);
- TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- } else if (ret == PRVINFO_ERROR_NONE) {
+ if (ret == PRVINFO_ERROR_NONE)
ret = privilege_info_get_string_by_string_id(string_id, description);
+ if (string_id != NULL)
free(string_id);
- TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- } else {
- return PRVINFO_ERROR_INTERNAL_ERROR;
- }
- return PRVINFO_ERROR_NONE;
+
+ return ret;
}
PI_API
int privilege_info_get_display_name_by_pkgtype(const char *package_type, const char *api_version, const char *privilege, char **display_name)
{
- int ret = 0;
- char* string_id = NULL;
-
TryReturn(package_type != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL");
TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
+ int ret = 0;
+ char* string_id = NULL;
+
ret = privilege_info_get_string_id(package_type, 1, api_version, privilege, &string_id);
TryReturn(ret != PRVINFO_ERROR_INVALID_PARAMETER, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] invalid package_type : %s", package_type);
- if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
- char* tempPrivilege = NULL;
- char* token = NULL;
- char* temp = NULL;
- char* save = NULL;
- tempPrivilege = strdup(privilege);
- TryReturn(tempPrivilege != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] tempPrivilege's strdup is failed.");
- token = strtok_r(tempPrivilege, "/", &save);
- while (token) {
- temp = token;
- token = strtok_r(NULL, "/", &save);
- }
- TryReturn(temp != NULL, free(tempPrivilege), PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] invalid privilege <%s>", privilege);
- *display_name = strdup(temp);
- TryReturn(*display_name != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- free(tempPrivilege);
- } else if (ret == PRVINFO_ERROR_NONE) {
+ if (ret == PRVINFO_ERROR_NONE)
ret = privilege_info_get_string_by_string_id(string_id, display_name);
+ if (string_id != NULL)
free(string_id);
- TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- } else {
- return PRVINFO_ERROR_INTERNAL_ERROR;
- }
- return PRVINFO_ERROR_NONE;
+
+ return ret;
}
PI_API
int privilege_info_get_description_by_pkgtype(const char *package_type, const char *api_version, const char *privilege, char **description)
{
- int ret = 0;
- char* string_id = NULL;
-
TryReturn(package_type != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL");
TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
+ int ret = 0;
+ char* string_id = NULL;
+
ret = privilege_info_get_string_id(package_type, 0, api_version, privilege, &string_id);
TryReturn(ret != PRVINFO_ERROR_INVALID_PARAMETER, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] invalid package_type : %s", package_type);
- if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
- ret = privilege_info_get_string_by_string_id("IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED", description);
- TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- } else if (ret == PRVINFO_ERROR_NONE) {
+ if (ret == PRVINFO_ERROR_NONE)
ret = privilege_info_get_string_by_string_id(string_id, description);
+ if (string_id != NULL)
free(string_id);
- TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- } else {
- return PRVINFO_ERROR_INTERNAL_ERROR;
- }
- return PRVINFO_ERROR_NONE;
+
+ return ret;
}
PI_API
return "PRVINFO_ERROR_INTERNAL_ERROR";
else if (ret == PRVINFO_ERROR_NOT_SUPPORTED)
return "PRVINFO_ERROR_NOT_SUPPORTED";
+ else if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE)
+ return "PRVINFO_ERROR_NO_MATCHING_PRIVILEGE";
return "PRVINFO_ERROR_NO_MATCHED_ERROR_MESSAGE";
}
static void __check_get_privilege_display_name_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* display_name)
{
- printf("expected result = %s, result = %s\n", __get_result_string(expected_result), __get_result_string(result));
+ printf("expected : %s\n result : %s\n", __get_result_string(expected_result), __get_result_string(result));
if (expected_result != result) {
printf("not matched\n");
} else {
printf("display_name = %s\n", display_name);
}
- } else {
+ } else if (result == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
if (display_name != NULL) {
printf("display_name = %s\n", display_name);
printf("display_name must be NULL\n");
static void __check_get_privilege_description_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* description)
{
- printf("expected result = %s, result = %s\n", __get_result_string(expected_result), __get_result_string(result));
+ printf("expected : %s\n result : %s\n", __get_result_string(expected_result), __get_result_string(result));
if (expected_result != result) {
printf("not matched\n");
} else {
printf("description = %s\n", description);
}
- } else {
+ } else if (result == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
if (description != NULL) {
printf("description = %s\n", description);
printf("description must be NULL\n");
static void __check_get_privacy_display_name_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* privacy_display)
{
- printf("expectd result %s, result = %s\n", __get_result_string(expected_result), __get_result_string(result));
+ printf("expected : %s\n result : %s\n", __get_result_string(expected_result), __get_result_string(result));
if (expected_result != result) {
printf("not matched\n");
printf("-----------------------------------------------------------\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/window.priority.set\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/window.priority.set", &display_name);
__check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
printf("-----------------------------------------------------------\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (display_name != NULL) {
free(display_name);
display_name = NULL;
printf("Not existing privilege\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (display_name != NULL) {
free(display_name);
display_name = NULL;
}
ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/RRRRRRRRRR", &display_name);
- __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+ __check_get_privilege_display_name_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, display_name);
printf("-----------------------------------------------------------\n");
printf("Invalid parameter\n");
printf("api_version : NULL\n");
printf("privilege : http://tizen.org/privilege/window.priority.set\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (display_name != NULL) {
free(display_name);
display_name = NULL;
free(display_name);
}
+
static void __test_privilege_info_get_display_name_by_pkgtype()
{
int ret;
printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/window.priority.set\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/window.priority.set", &display_name);
__check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
printf("pkgtype : PRVINFO_PACKAGE_TYPE_WEB\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (display_name != NULL) {
free(display_name);
display_name = NULL;
printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (display_name != NULL) {
free(display_name);
display_name = NULL;
}
ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/mediacapture", &display_name);
- __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+ __check_get_privilege_display_name_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, display_name);
printf("-----------------------------------------------------------\n");
printf("Not existing privilege\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (display_name != NULL) {
free(display_name);
display_name = NULL;
}
ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/RRRRRRRRRR", &display_name);
- __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+ __check_get_privilege_display_name_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, display_name);
printf("-----------------------------------------------------------\n");
printf("Invalid parameter\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (display_name != NULL) {
free(display_name);
display_name = NULL;
printf("-----------------------------------------------------------\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/window.priority.set\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/window.priority.set", &description);
__check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
printf("-----------------------------------------------------------\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (description != NULL) {
free(description);
description = NULL;
printf("Not existing privilege\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (description != NULL) {
free(description);
description = NULL;
}
ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/RRRRRRRRRR", &description);
- __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+ __check_get_privilege_description_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, description);
printf("-----------------------------------------------------------\n");
printf("Invalid parameter\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (description != NULL) {
free(description);
description = NULL;
printf("-----------------------------------------------------------\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/window.priority.set\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/window.priority.set", &description);
__check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
printf("-----------------------------------------------------------\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (description != NULL) {
free(description);
description = NULL;
printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (description != NULL) {
free(description);
description = NULL;
}
ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/mediacapture", &description);
- __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+ __check_get_privilege_description_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, description);
printf("-----------------------------------------------------------\n");
printf("Not existing privilege\n");
printf("api_version : 2.3\n");
printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
if (description != NULL) {
free(description);
description = NULL;
}
ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/RRRRRRRRRR", &description);
- __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+ __check_get_privilege_description_result(PRVINFO_ERROR_NO_MATCHING_PRIVILEGE, ret, description);
printf("-----------------------------------------------------------\n");
printf("Invalid parameter\n");
printf("api_version : 2.3\n");
printf("privilege : NULL\n");
- printf("expected result : PRVINFO_ERROR_INVALID_PARAMETER\n");
if (description != NULL) {
free(description);
description = NULL;
static void __check_privilege_info_get_privilege_info(privilege_info_error_e expected_result, privilege_info_error_e result, GList* privilege_info_list, int return_result)
{
- printf("expected result = %s, result = %s\n", __get_result_string(expected_result), __get_result_string(result));
+ printf("expected : %s\n result : %s\n", __get_result_string(expected_result), __get_result_string(result));
if (expected_result != result) {
__change_color_to_yellow();
- printf("not mached\n");
+ printf("not matched\n");
__change_color_to_origin();
} else {
__change_color_to_green();
- printf("mached\n");
+ printf("matched\n");
__change_color_to_origin();
}
printf("privilege name : http://tizen.org/privilege/call\n");
printf("privilege name : http://tizen.org/privilege/content.read\n");
printf("privilege name : http://tizen.org/privilege/filesystem.read\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/content.read");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/filesystem.read");
printf("privilege name : http://tizen.org/privilege/call\n");
printf("privilege name : http://tizen.org/privilege/systemsettings.admin\n");
printf("privilege name : http://tizen.org/privilege/bookmark.admin\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/systemsettings.admin");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/bookmark.admin");
printf("privilege name : http://tizen.org/privilege/call\n");
printf("privilege name : http://tizen.org/privilege/alarm.xxxx\n");
printf("privilege name : http://tizen.org/privilege/account.xxx\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/alarm.xxxx");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/account.xxx");
printf("privilege name : http://tizen.org/privilege/call\n");
printf("privilege name : http://tizen.org/privilege/content.read\n");
printf("privilege name : http://tizen.org/privilege/filesystem.read\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/call");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/content.read");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/filesystem.read");
printf("privilege name : http://tizen.org/privilege/xxxx\n");
printf("privilege name : http://tizen.org/privilege/alarm.xxxx\n");
printf("privilege name : http://tizen.org/privilege/account.xxx\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/xxxx");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/alarm.xxxx");
privilege_name_list = g_list_append(privilege_name_list, "http://tizen.org/privilege/account.xxx");