Determine askuser enable by security config file 46/234846/3
authorYunjin Lee <yunjin-.lee@samsung.com>
Fri, 29 May 2020 07:09:17 +0000 (16:09 +0900)
committerYunjin Lee <yunjin-.lee@samsung.com>
Fri, 29 May 2020 09:58:58 +0000 (18:58 +0900)
- When checking current target support askuser or not, see whether the
askuser_disable file exist or not.

- The profile file is used for checking different storage privacy support
among profiles.

Change-Id: I7be583ac275f10575220c6ace3d1dd64522c14fe
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
capi/include/privilege_private.h
capi/src/privilege_info.c

index 0d22c72..6d0265f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright(c) 2016-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.
@@ -17,6 +17,8 @@
 #ifndef __TIZEN_SECURITY_PRIVILEGE_PRIVATE_H
 #define __TIZEN_SECURITY_PRIVILEGE_PRIVATE_H
 
+#include <unistd.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -36,10 +38,8 @@ extern privilege_profile_type_e get_priv_profile();
 
 #define g_privilege_profile_type (get_priv_profile())
 
-#define ENABLE_ASKUSER ((g_privilege_profile_type == PRIVILEGE_PROFILE_TYPE_MOBILE) || \
-               (g_privilege_profile_type == PRIVILEGE_PROFILE_TYPE_WEARABLE))
-#define DISABLE_ASKUSER (!ENABLE_ASKUSER)
-
+#define DISABLE_ASKUSER (access(ASKUSER_RUNTIME_DISABLE_PATH, F_OK) == 0)
+#define ENABLE_ASKUSER (!DISABLE_ASKUSER)
 
 typedef u_int32_t api_version_code_t;
 extern int __get_api_version_code(const char* api_version, api_version_code_t* api_version_code);
index 06d9f41..8fdb5a7 100755 (executable)
@@ -549,16 +549,10 @@ int privilege_info_get_privilege_description(const char *privilege, char **descr
 
 int privilege_info_is_privacy(const char* privilege)
 {
-       int ret;
-
        TryReturn(privilege != NULL, , PRVMGR_ERR_INVALID_PARAMETER, "[PRVMGR_ERR_INVALID_PARAMETER] privilege is NULL");
        if (DISABLE_ASKUSER)
                return 0;
-       if (access(ASKUSER_RUNTIME_DISABLE_PATH, F_OK) == 0) {
-               LOGD("askuser is disabled in run-time.");
-               return 0;
-       }
-       ret = privilege_db_manager_is('p', privilege);
+       int ret = privilege_db_manager_is('p', privilege);
        if (ret != 0 && ret != 1)
                ret = -1;
        return ret;