Remove deprecated API 18/233018/3
authorYunjin Lee <yunjin-.lee@samsung.com>
Mon, 11 May 2020 08:52:20 +0000 (17:52 +0900)
committerYunjin Lee <yunjin-.lee@samsung.com>
Tue, 19 May 2020 08:20:39 +0000 (17:20 +0900)
- Remove 5.0 deprecated API and related local test cases

Change-Id: I7e24ea3c41b45ada1358ac55508c3072c7f35728
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
packaging/privilege-info.spec
src/CMakeLists.txt
src/include/privilege_information.h
src/privilege_information.c
test/CMakeLists.txt
test/org.tizen.test-privilege-info.manifest [deleted file]
test/org.tizen.test-privilege-info.xml [deleted file]
test/tc_privilege_info_app_privacy.c [deleted file]

index 6201068..ec1896c 100644 (file)
@@ -13,9 +13,6 @@ BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(capi-base-common)
 BuildRequires: pkgconfig(security-privilege-manager)
-BuildRequires: pkgconfig(cynara-client)
-BuildRequires: pkgconfig(cynara-session)
-BuildRequires: pkgconfig(libsmack)
 BuildRequires: pkgconfig(libtzplatform-config)
 BuildRequires: pkgconfig(capi-system-info)
 %if 0%{?gcov:1}
@@ -105,10 +102,6 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
 %post -n privilege-info -p /sbin/ldconfig
 %postun -n privilege-info -p /sbin/ldconfig
 
-%post -n tc-privilege-info
-tpk-backend -y org.tizen.test-privilege-info --preload
-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*
 %license LICENSE.Apache-2.0
@@ -119,9 +112,6 @@ cyad -s -k MANIFESTS_GLOBAL -c User::Pkg::org.tizen.test-privilege-info -u '*' -
 %{_libdir}/pkgconfig/privilege-info.pc
 
 %files -n tc-privilege-info
-%manifest test/org.tizen.test-privilege-info.manifest
-%{TZ_SYS_RO_APP}/org.tizen.test-privilege-info/bin/tc-privilege-info-app-privacy
-%{TZ_SYS_RO_PACKAGES}/org.tizen.test-privilege-info.xml
 %{_bindir}/tc-privilege-info
 
 %if 0%{?gcov:1}
index b0789ab..a0cf43c 100755 (executable)
@@ -8,7 +8,7 @@ SET(PRIV_INFO_SOURCES
 
 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)
 
-SET(requires glib-2.0 dlog security-privilege-manager cynara-client cynara-session libsmack capi-system-info)
+SET(requires glib-2.0 dlog security-privilege-manager capi-system-info)
 INCLUDE(FindPkgConfig)
 pkg_check_modules(${PACKAGE_NAME} REQUIRED ${requires})
 FOREACH(flag ${${PACKAGE_NAME}_CFLAGS})
index 29e83f2..f1eb304 100755 (executable)
@@ -150,25 +150,6 @@ int privilege_info_get_privacy_display_name(const char *privilege, char **privac
 
 
 /**
- * @deprecated Deprecated since 5.0. Use ppm_check_permission() instead. You can refer to @ref CAPI_PRIVACY_PRIVILEGE_MANAGER_MODULE.
- * @brief Gets the status of the given privacy related privilege.
- * @since_tizen 3.0
- * @remarks @a privilege must be privacy related, otherwise #PRVINFO_ERROR_INVALID_PARAMETER is returned.
- *          In case of errors, @a status is set to @c true.
- * @param[in] privilege The privilege
- * @param[out] status @c true if the privilege is on,
- *                    and @c false if the privilege is off
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #PRVINFO_ERROR_NONE Successful
- * @retval #PRVINFO_ERROR_INVALID_PARAMETER Invalid function parameter
- * @retval #PRVINFO_ERROR_INTERNAL_ERROR Unknown error
- * @retval #PRVINFO_ERROR_NOT_SUPPORTED Not supported
- */
-int privilege_info_get_privacy_privilege_status(const char *privilege, bool *status) TIZEN_DEPRECATED_API;
-
-
-/**
  * @brief The structure for privilege information.
  * @since_tizen 5.5
  */
@@ -227,8 +208,6 @@ int privilege_info_get_privilege_info_list(const char* locale, GList* privilege_
 int privilege_info_free_privilege_info_list(GList* privilege_info_list);
 
 
-
-
 /**
  * @}
  */
index 1c7687b..1f58050 100755 (executable)
@@ -18,8 +18,6 @@
 #include <stdlib.h>
 #include <libintl.h>
 #include <dlog.h>
-#include <unistd.h>
-#include <sys/smack.h>
 #include <system_info.h>
 #include <locale.h>
 #include <glib.h>
@@ -27,9 +25,6 @@
 #include <privilege_db_manager.h>
 #include <privilege_info.h>
 
-#include <cynara-session.h>
-#include <cynara-client.h>
-
 #include "privilege_information.h"
 
 #ifdef LOG_TAG
@@ -52,8 +47,6 @@
                } \
        } while (0)
 
-#define UIDMAXLEN 10
-
 #define TryReturn(condition, expr, returnValue, ...)  \
        if (!(condition)) { \
                expr; \
@@ -234,48 +227,6 @@ int privilege_info_get_privacy_display_name(const char *privilege, char **privac
 }
 
 PI_API
-int privilege_info_get_privacy_privilege_status(const char *privilege, bool *status)
-{
-       LOGW("DEPRECATION WARNING: privilege_info_get_privacy_privilege_status() is deprecated and will be removed from next release. Use ppm_check_permission() instead.");
-       CHECK_FEATURE_SUPPORTED(PRIVACY_FEATURE);
-       TryReturn(privilege != NULL, *status = true, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
-       TryReturn(privilege_db_manager_is('p', privilege) == 1, *status = true, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege does not exist or is not a privacy related");
-
-       char* smack_label = NULL;
-       TryReturn(smack_new_label_from_self(&smack_label) != -1, *status = true, PRVINFO_ERROR_INTERNAL_ERROR, "[PRVINFO_ERROR_INTERNAL_ERROR] smack_new_label_from_self() failed.");
-
-       cynara *cynara = NULL;
-       TryReturn(cynara_initialize(&cynara, NULL) == CYNARA_API_SUCCESS, *status = true; cynara = NULL; free(smack_label), PRVINFO_ERROR_INTERNAL_ERROR, "[PRVINFO_ERROR_INTERNAL_ERROR] cynara_initialize() failed.");
-
-       char *session = NULL;
-       session = cynara_session_from_pid(getpid());
-       TryReturn(session != NULL, *status = true; cynara_finish(cynara); free(smack_label), PRVINFO_ERROR_INTERNAL_ERROR, "[PRVINFO_ERROR_INTERNAL_ERROR] cynara_session_from_pid() failed");
-
-       char uid[UIDMAXLEN];
-       int result = snprintf(uid, UIDMAXLEN, "%d", getuid());
-       TryReturn(uid != NULL && result > 0, *status = true; free(session); cynara_finish(cynara); free(smack_label), PRVINFO_ERROR_INTERNAL_ERROR, "[PRVINFO_ERROR_INTERNAL_ERROR] snprintf() for uid failed.");
-
-       result = cynara_simple_check(cynara, smack_label, session, uid, privilege);
-       int ret = PRVINFO_ERROR_NONE;
-       free(session);
-       cynara_finish(cynara);
-
-       LOGD("result of cynara_check(cynara %s, session, %s, %s) result = %d", smack_label, uid, privilege, result);
-       free(smack_label);
-       if (result == CYNARA_API_ACCESS_DENIED) {
-               *status = false;
-       } else if (result == CYNARA_API_ACCESS_ALLOWED) {
-               *status = true;
-       } else {
-               *status = true;
-               LOGE("[PRVINFO_ERROR_INTERNAL_ERROR] cynara_check() failed. ret = %d", result);
-               ret = PRVINFO_ERROR_INTERNAL_ERROR;
-       }
-
-       return ret;
-}
-
-PI_API
 int privilege_info_get_privilege_info_list(const char* locale, GList* privilege_name_list, GList** privilege_info_list, privilege_consumer_return_code_e* return_result)
 {
        GList *l;
index 18d6f42..8da99db 100755 (executable)
@@ -3,10 +3,8 @@ SET(PACKAGE_NAME tc-privilege-info)
 PROJECT(${PACKAGE_NAME})
 
 SET(TC1_NAME tc-privilege-info)
-SET(TC2_NAME tc-privilege-info-app-privacy)
 
 SET(TC1_SRCS ${PROJECT_SOURCE_DIR}/tc_privilege_info.c)
-SET(TC2_SRCS ${PROJECT_SOURCE_DIR}/tc_privilege_info_app_privacy.c)
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include)
 
@@ -21,11 +19,6 @@ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC -Wall -fvisibility=hidden -D_WITH_SYSTEM
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${PACKAGE_NAME_CFLAGS}")
 
 ADD_EXECUTABLE(${TC1_NAME} ${TC1_SRCS})
-ADD_EXECUTABLE(${TC2_NAME} ${TC2_SRCS})
 TARGET_LINK_LIBRARIES(${TC1_NAME} "privilege-info")
-TARGET_LINK_LIBRARIES(${TC2_NAME} "privilege-info")
 
 INSTALL(TARGETS ${TC1_NAME} DESTINATION /usr/bin)
-INSTALL(TARGETS ${TC2_NAME} DESTINATION ${TZ_SYS_RO_APP}/org.tizen.test-privilege-info/bin/)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/test/org.tizen.test-privilege-info.xml DESTINATION ${TZ_SYS_RO_PACKAGES})
-
diff --git a/test/org.tizen.test-privilege-info.manifest b/test/org.tizen.test-privilege-info.manifest
deleted file mode 100644 (file)
index ccea6a9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<manifest>
-    <request>
-               <domain name="_" />
-       </request>
-</manifest>
-
diff --git a/test/org.tizen.test-privilege-info.xml b/test/org.tizen.test-privilege-info.xml
deleted file mode 100644 (file)
index c9d7ab2..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.test-privilege-info" version="1.0.1" install-location="internal-only">
-    <ui-application appid="org.tizen.test-privilege-info" exec="tc-privilege-info-app-privacy" nodisplay="true" multiple="false" type ="capp" taskmanage="false" component-type="svcapp">
-        <label>org.tizen.test-privilege-info</label>
-    </ui-application>
-    <privileges>
-        <privilege>http://tizen.org/privilege/account.read</privilege>
-        <privilege>http://tizen.org/privilege/contact.read</privilege>
-    </privileges>
-</manifest>
-
-
diff --git a/test/tc_privilege_info_app_privacy.c b/test/tc_privilege_info_app_privacy.c
deleted file mode 100644 (file)
index 6df037c..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#include <stdio.h>
-#include <dlog.h>
-#include <stdbool.h>
-#include <privilege_information.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#define LOG_TAG "PRIVILEGE_INFO_TEST_APP"
-#endif
-
-
-static int fail_cnt = 0;
-static int success_cnt = 0;
-
-static const char *__get_result_string(privilege_info_error_e ret)
-{
-       if (ret == PRVINFO_ERROR_NONE)
-               return "PRVINFO_ERROR_NONE";
-       else if (ret == PRVINFO_ERROR_INVALID_PARAMETER)
-               return "PRVINFO_ERROR_INVALID_PARAMETER";
-       else if (ret == PRVINFO_ERROR_INTERNAL_ERROR)
-               return "PRVINFO_ERROR_INTERNAL_ERROR";
-       else if (ret == PRVINFO_ERROR_OUT_OF_MEMORY)
-               return "PRVINFO_ERROR_UNDECLARED_PRIVILEGE";
-       else
-               return "FAIL";
-}
-
-static void __check_result(privilege_info_error_e expected_result, privilege_info_error_e result, bool expected_status, bool status)
-{
-       LOGD("expected result = %s, result = %s", __get_result_string(expected_result), __get_result_string(result));
-       LOGD("expected status = %s, status = %s", expected_status ? "true" : "false", status ? "true" : "false");
-
-       if (expected_result != result) {
-               LOGD("test fail");
-               fail_cnt++;
-       } else {
-               if (expected_status != status) {
-                       LOGD("test fail");
-                       fail_cnt++;
-               } else {
-                       LOGD("test success");
-                       success_cnt++;
-               }
-       }
-}
-
-static void __test_privilege_info_get_privacy_privilege_status()
-{
-       int ret = PRVINFO_ERROR_NONE;
-       bool status;
-
-       LOGD("-----------------------------------------------------------");
-       LOGD("privilege : http://tizen.org/privilege/account.read");
-       LOGD("expected result : PRVINFO_ERROR_NONE");
-       ret = privilege_info_get_privacy_privilege_status("http://tizen.org/privilege/account.read", &status);
-       __check_result(PRVINFO_ERROR_NONE, ret, true, status);
-       LOGD("-----------------------------------------------------------");
-
-       LOGD("privilege : http://tizen.org/privilege/contact.read");
-       LOGD("expected result : PRVINFO_ERROR_NONE");
-       ret = privilege_info_get_privacy_privilege_status("http://tizen.org/privilege/contact.read", &status);
-       __check_result(PRVINFO_ERROR_NONE, ret, false, status);
-       LOGD("-----------------------------------------------------------");
-
-       LOGD("privilege : http://tizen.org/privilege/aaaaa");
-       LOGD("expected result : PRVINFO_ERROR_INVALID_PARAMETER");
-       ret = privilege_info_get_privacy_privilege_status("http://tizen.org/privilege/aaaaa", &status);
-       __check_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, true, status);
-       LOGD("-----------------------------------------------------------");
-
-}
-
-int main()
-{
-       LOGD("Test function : privilege_info_get_privacy_privilege_status");
-       __test_privilege_info_get_privacy_privilege_status();
-
-       LOGD("====================================");
-       LOGD("Test Complete");
-       LOGD("success : %d, ", success_cnt);
-       LOGD("fail : %d", fail_cnt);
-       LOGD("====================================");
-
-       return 0;
-}