Change the privicy-manager to cynara_check 49/63449/1 accepted/tizen/common/20160324.173032 accepted/tizen/ivi/20160408.104331 accepted/tizen/mobile/20160408.104243 accepted/tizen/tv/20160408.104251 accepted/tizen/wearable/20160408.104312 submit/tizen/20160324.050130 submit/tizen/20160408.054230
authorkj7.sung <kj7.sung@samsung.com>
Thu, 24 Mar 2016 04:48:13 +0000 (13:48 +0900)
committerkj7.sung <kj7.sung@samsung.com>
Thu, 24 Mar 2016 04:48:13 +0000 (13:48 +0900)
Change-Id: I4bf69c9f1d065199226e993ccce91a2329ca90ea
Signed-off-by: kj7.sung <kj7.sung@samsung.com>
CMakeLists.txt
location/manager/location-privacy.c
location/manager/location-privacy.h
location/manager/location.c
packaging/liblbs-location.changes
packaging/liblbs-location.spec

index 9a8d019..995ba52 100755 (executable)
@@ -14,7 +14,7 @@ IF(FEATURE_PROFILE_TV)
         ADD_DEFINITIONS("-DTIZEN_PROFILE_TV")
        SET(PRIVACY_PKG "")
 ELSE(FEATURE_PROFILE_TV)
-       SET(PRIVACY_PKG "privacy-manager-client")
+       SET(PRIVACY_PKG "cynara-client cynara-session")
 
        IF(FEATURE_PROFILE_WEARABLE)
                MESSAGE("<<< Wearable Profile >>>")
@@ -24,8 +24,7 @@ ELSE(FEATURE_PROFILE_TV)
        ENDIF(FEATURE_PROFILE_WEARABLE)
 ENDIF(FEATURE_PROFILE_TV)
 
-pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 gobject-2.0 gmodule-2.0
-               capi-appfw-app-manager capi-appfw-package-manager pkgmgr-info
+pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 gobject-2.0 gmodule-2.0 capi-appfw-app-manager
                dlog vconf json-glib-1.0 bundle eventsystem libtzplatform-config ${PRIVACY_PKG})
 
 FOREACH(flag ${pkgs_CFLAGS})
index 625d9bb..ec3eede 100644 (file)
 #include <sys/types.h>
 #include <unistd.h>
 #include <glib.h>
+#include <stdio.h>
 #include <stdlib.h>
 
 #include <app_manager.h>
-#include <package_manager.h>
-#include <pkgmgr-info.h>
-#include <privacy_checker_client.h>
+#include <cynara-client.h>
+#include <cynara-session.h>
 
 #include "location-common-util.h"
 #include "location-types.h"
 #include "location-log.h"
 #include "location-privacy.h"
 
-typedef struct _location_privilege_s {
-       char *name;
-       bool found;
-} location_privilege_s;
-
-
-
-void
-location_privacy_initialize(void)
-{
-       int ret = 0;
-       pid_t pid = 0;
-       char *app_id = NULL;
-       char *package_id = NULL;
-       pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo;
-
-       pid = getpid();
-       ret = app_manager_get_app_id(pid, &app_id);
-       if (ret != APP_MANAGER_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
-               return;
-       }
-
-       ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo);
-       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get appinfo for [%s]. Err[%d]", app_id, ret);
-               free(app_id);
-               return;
-       }
-
-       ret = pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo, &package_id);
-       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get package_id for [%s]. Err[%d]", app_id, ret);
-               pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
-               free(app_id);
-               return;
-       }
-
-       ret = privacy_checker_initialize(package_id);
-       if (ret != PRIV_MGR_ERROR_SUCCESS) {
-               LOCATION_LOGE("Fail to initialize privacy checker. err[%d]", ret);
-               pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
-               free(app_id);
-               return;
-       }
-
-       LOCATION_LOGD("Success to initialize privacy checker");
-
-       free(app_id);
-       pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
-}
-
-void
-location_privacy_finalize(void)
-{
-       int ret = 0;
-       ret = privacy_checker_finalize();
-       if (ret != PRIV_MGR_ERROR_SUCCESS) {
-               LOCATION_LOGE("Fail to finalize privacy_cehecker. Err[%d]", ret);
-               return;
-       }
-
-       LOCATION_LOGD("Success to finalize privacy checker");
-}
-
-int
-location_get_privacy(const char *privilege_name)
+int location_check_cynara(const char *privilege_name)
 {
-       int ret = 0;
-       pid_t pid = 0;
-       char *app_id = NULL;
-       char *package_id = NULL;
-       int app_type = 0;
-       pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo;
-
-       pid = getpid();
-       ret = app_manager_get_app_id(pid, &app_id);
-       if (ret != APP_MANAGER_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
-               return LOCATION_ERROR_NONE;
-       }
-
-       app_type = location_get_app_type(app_id);
-       if (app_type == CPPAPP) {
-               LOCATION_LOGE("CPPAPP use location");
-               g_free(app_id);
-               return LOCATION_ERROR_NONE;
-       }
-
-       ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo);
-       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get appinfo for [%s]. Err[%d]", app_id, ret);
-               g_free(app_id);
+       cynara *cynara = NULL;
+       int ret = LOCATION_ERROR_NONE;
+       FILE *fp = NULL;
+       char uid[16];
+       char *session = NULL;
+       char smack_label[100] = "/proc/self/attr/current";
+
+       if (cynara_initialize(&cynara, NULL) != CYNARA_API_SUCCESS)
+       {
+               LOCATION_LOGE("cynara initialize failed");
+               cynara = NULL;
                return LOCATION_ERROR_NOT_ALLOWED;
        }
 
-       ret = pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo, &package_id);
-       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get package_id for [%s]. Err[%d]", app_id, ret);
-               g_free(app_id);
-               pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
-
-#ifdef TIZEN_PROFILE_WERABLE
-       if (app_type == WEBAPP) {
-               LOCATION_LOGI("WEBAPP use location");
-               if (location_get_webapp_privilege(package_id, privilege_name) == 0) {
-                       g_free(package_id);
-                       g_free(app_id);
-                       return LOCATION_ERROR_NONE;
+       fp = fopen("/proc/self/attr/current", "r");
+       if (fp != NULL) {
+               if (fread(smack_label, 1, sizeof(smack_label), fp) <= 0) {
+                       LOCATION_LOGE("fread failed");
                }
+               fclose(fp);
        }
-#endif
-
-       ret = privacy_checker_check_package_by_privilege(package_id, privilege_name);
-       if (ret != PRIV_MGR_ERROR_SUCCESS) {
-               LOCATION_LOGE("Fail to get privilege for [%s]. Err[%d]", package_id, ret);
-               pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
-               g_free(app_id);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
-
-       pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
-       g_free(app_id);
-
-       return LOCATION_ERROR_NONE;
-}
-
 
-int
-location_check_privilege(const char *privilege_name)
-{
-       int ret = 0;
-       pid_t pid = 0;
-       char *app_id = NULL;
-       char *package_id = NULL;
-       int app_type = 0;
-       pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo;
+       pid_t pid = getpid();
+       session = cynara_session_from_pid(pid);
+       snprintf(uid, 16, "%d", getuid());
+       ret = cynara_check(cynara, smack_label, session, uid, privilege_name);
 
-       pid = getpid();
-       ret = app_manager_get_app_id(pid, &app_id);
-       if (ret != APP_MANAGER_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
-               return LOCATION_ERROR_NONE;
+       if (session) {
+               free(session);
        }
 
-       app_type = location_get_app_type(app_id);
-       if (app_type == CPPAPP) {
-               LOCATION_LOGE("CPPAPP use location");
-               g_free(app_id);
-               return LOCATION_ERROR_NONE;
+       if (cynara) {
+               cynara_finish(cynara);
        }
 
-       ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo);
-       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get appinfo for [%s]. Err[%d]", app_id, ret);
-               g_free(app_id);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
-
-       ret = pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo, &package_id);
-       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get package_id for [%s]. Err[%d]", app_id, ret);
-               g_free(app_id);
-               pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
-
-#ifdef TIZEN_WERABLE
-       if (app_type == WEBAPP) {
-               LOCATION_LOGE("WEBAPP use location");
-               if (location_get_webapp_privilege(package_id, privilege_name) == 0) {
-                       g_free(package_id);
-                       g_free(app_id);
-                       return LOCATION_ERROR_NONE;
-               }
-       }
-#endif
-
-       ret = privacy_checker_initialize(package_id);
-       if (ret != PRIV_MGR_ERROR_SUCCESS) {
-               LOCATION_LOGE("Fail to initialize privacy checker. err[%d]", ret);
-               pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
-               g_free(app_id);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
-
-       ret = privacy_checker_check_package_by_privilege(package_id, privilege_name);
-       if (ret != PRIV_MGR_ERROR_SUCCESS) {
-               LOCATION_LOGE("Fail to get privilege for [%s]. Err[%d]", package_id, ret);
-               pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
-               g_free(app_id);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
-
-       pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
-       g_free(app_id);
-
-       ret = privacy_checker_finalize();
-       if (ret != PRIV_MGR_ERROR_SUCCESS) {
-               LOCATION_LOGE("Fail to finalize privacy_cehecker. Err[%d]", ret);
+       if (ret != CYNARA_API_ACCESS_ALLOWED) {
+               LOCATION_LOGE("cynara_check failed [%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
 
        return LOCATION_ERROR_NONE;
 }
-
index 8393d0a..6927ab6 100644 (file)
 #ifndef __LOCATION_PRIVACY_H__
 #define __LOCATION_PRIVACY_H__
 
-void location_privacy_initialize(void);
-void location_privacy_finalize(void);
-int location_get_privacy(const char *privilege_name);
-int location_check_privilege(const char *privilege_name);
+int location_check_cynara(const char *privilege_name);
 
 
 #endif /* __LOCATION_PRIVACY_H__ */
index 851f7e7..ab81fe8 100755 (executable)
@@ -119,10 +119,6 @@ int location_init(void)
        if (FALSE == module_init())
                return LOCATION_ERROR_NOT_AVAILABLE;
 
-#ifndef TIZEN_PROFILE_TV
-       location_privacy_initialize();
-#endif
-
        return LOCATION_ERROR_NONE;
 }
 
@@ -156,10 +152,6 @@ EXPORT_API int
 location_free(LocationObject *obj)
 {
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
-
-#ifndef TIZEN_PROFILE_TV
-       location_privacy_finalize();
-#endif
        g_object_unref(obj);
        return LOCATION_ERROR_NONE;
 }
@@ -170,15 +162,6 @@ location_request_single_location(LocationObject *obj, int timeout)
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
-
-#ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
-#endif
-
        ret = location_ielement_request_single_location(LOCATION_IELEMENT(obj), timeout);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to request single location. Error [%d]", ret);
 
@@ -193,7 +176,7 @@ location_start(LocationObject *obj)
        int ret = LOCATION_ERROR_NONE;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -212,14 +195,6 @@ location_stop(LocationObject *obj)
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
        int ret = LOCATION_ERROR_NONE;
 
-#ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
-#endif
-
        ret = location_ielement_stop(LOCATION_IELEMENT(obj));
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to stop. Error [%d]", ret);
 
@@ -233,7 +208,7 @@ location_start_batch(LocationObject *obj)
        int ret = LOCATION_ERROR_NONE;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -251,15 +226,6 @@ location_stop_batch(LocationObject *obj)
 {
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
        int ret = LOCATION_ERROR_NONE;
-
-#ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
-#endif
-
        ret = location_ielement_stop_batch(LOCATION_IELEMENT(obj));
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to Batch stop. Error [%d]", ret);
 
@@ -327,7 +293,7 @@ location_enable_method(const LocationMethod method, const int enable)
        char *_key = NULL;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_check_privilege(LOCATION_ENABLE_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_ENABLE_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -439,7 +405,7 @@ location_get_position(LocationObject *obj,
        int ret = LOCATION_ERROR_NONE;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -466,7 +432,7 @@ location_get_position_ext(LocationObject *obj,
        int ret = LOCATION_ERROR_NONE;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -491,7 +457,7 @@ location_get_last_position(LocationObject *obj,
        int ret = LOCATION_ERROR_NONE;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -518,7 +484,7 @@ location_get_last_position_ext(LocationObject *obj,
        int ret = LOCATION_ERROR_NONE;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -538,17 +504,10 @@ location_get_nmea(LocationObject *obj, char **nmea)
        g_return_val_if_fail(nmea, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
-
-#ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_ielement_get_nmea(LOCATION_IELEMENT(obj), nmea);
        if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
+               LOCATION_LOGE("Fail to get_nmea. Error [%d]", ret);
        }
-#endif
-
-       ret = location_ielement_get_nmea(LOCATION_IELEMENT(obj), nmea);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_nmea. Error [%d]", ret);
 
        return ret;
 }
@@ -563,7 +522,7 @@ location_get_satellite(LocationObject *obj, LocationSatellite **satellite)
        int ret = LOCATION_ERROR_NONE;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -571,7 +530,9 @@ location_get_satellite(LocationObject *obj, LocationSatellite **satellite)
 #endif
 
        ret = location_ielement_get_satellite(LOCATION_IELEMENT(obj), satellite);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_satellite. Error [%d]", ret);
+       if (ret != LOCATION_ERROR_NONE) {
+               LOCATION_LOGE("Fail to get_satellite. Error [%d]", ret);
+       }
 
        return ret;
 }
@@ -585,7 +546,7 @@ location_get_batch(LocationObject *obj, LocationBatch **batch)
        int ret = LOCATION_ERROR_NONE;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -607,7 +568,7 @@ location_get_last_satellite(LocationObject *obj, LocationSatellite **satellite)
        int ret = LOCATION_ERROR_NONE;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -632,7 +593,7 @@ location_get_velocity(LocationObject *obj,
        int ret = LOCATION_ERROR_NONE;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -657,7 +618,7 @@ location_get_last_velocity(LocationObject *obj,
        int ret = LOCATION_ERROR_NONE;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -729,7 +690,7 @@ location_set_option(LocationObject *obj, const char *option)
        int ret = LOCATION_ERROR_NONE;
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -754,15 +715,6 @@ location_get_service_state(LocationObject *obj, int *state)
        g_return_val_if_fail(state, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
-
-#ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
-#endif
-
        ret = location_ielement_get_status(LOCATION_IELEMENT(obj), state);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_position. Error [%d]", ret);
 
@@ -781,7 +733,7 @@ location_enable_mock(const LocationMethod method, const int enable)
        }
 
 #ifndef TIZEN_PROFILE_TV
-       ret = location_check_privilege(LOCATION_PRIVILEGE);
+       ret = location_check_cynara(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -881,15 +833,6 @@ location_set_mock_location(LocationObject *obj, const LocationPosition *position
        g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
-
-#ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
-#endif
-
        ret = location_ielement_set_mock_location(LOCATION_IELEMENT(obj), position, velocity, accuracy);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to location_ielement_set_mock_location. Error [%d]", ret);
 
@@ -902,15 +845,6 @@ location_clear_mock_location(LocationObject *obj)
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
-
-#ifndef TIZEN_PROFILE_TV
-       ret = location_get_privacy(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
-#endif
-
        ret = location_ielement_clear_mock_location(LOCATION_IELEMENT(obj));
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to location_ielement_set_mock_location. Error [%d]", ret);
 
index 71a87f7..57b9bae 100644 (file)
@@ -1,3 +1,10 @@
+[Version]      libslp-location_1.1.0
+[Date]         24 May 2016
+[Changes]      Privacy check method changed to cynara
+[Developer]    Kyoungjun Sung <kj7.sung@samsung.com>
+
+================================================================================
+
 [Version]      libslp-location_1.0.0
 [Date]         19 January 2016
 [Changes]      Supported mock location
index a81f187..4d14cba 100755 (executable)
@@ -1,6 +1,6 @@
 Name: liblbs-location
 Summary: Location Based Service Library
-Version: 1.0.0
+Version: 1.1.0
 Release: 1
 Group: Location/Libraries
 License: Apache-2.0
@@ -14,10 +14,9 @@ BuildRequires:  pkgconfig(gmodule-2.0)
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(capi-appfw-app-manager)
-BuildRequires:  pkgconfig(capi-appfw-package-manager)
-BuildRequires:  pkgconfig(pkgmgr-info)
 %if "%{profile}" != "tv"
-BuildRequires:  pkgconfig(privacy-manager-client)
+BuildRequires:  pkgconfig(cynara-client)
+BuildRequires:  pkgconfig(cynara-session)
 %endif
 BuildRequires:  pkgconfig(json-glib-1.0)
 BuildRequires:  pkgconfig(bundle)