From 8c23c519cd257c07370f068c0dd0b751b1c521e7 Mon Sep 17 00:00:00 2001 From: htt1997 Date: Wed, 5 Jul 2023 15:43:12 +0800 Subject: [PATCH] fix Signed-off-by: htt1997 --- .../service/CMakeLists.txt | 1 + .../libaccesstoken_sdk/include/access_token.h | 118 +++++++- .../include/access_token_error.h | 71 +++++ .../include/accesstoken_kit.h | 267 +++++++++++++++++- .../include/hap_token_info.h | 65 ++++- .../include/native_token_info.h | 42 ++- .../perm_state_change_callback_customize.h | 48 +++- .../include/permission_def.h | 45 ++- .../include/permission_dlp_mode.h | 33 ++- .../include/permission_list_state.h | 33 ++- .../include/permission_state_change_info.h | 48 +++- .../include/permission_state_full.h | 38 ++- .../libaccesstoken_sdk/include/tokenid_kit.h | 34 +++ mock/napi/src/js_native_api.h | 3 - mock/sqlite/include/sqlite3.h | 60 ++-- mock/src/mock_ipc.cpp | 14 +- test/CMakeLists.txt | 1 + 17 files changed, 858 insertions(+), 63 deletions(-) create mode 100644 mock/innerkits/access_token/libaccesstoken_sdk/include/access_token_error.h create mode 100644 mock/innerkits/access_token/libaccesstoken_sdk/include/tokenid_kit.h diff --git a/datamgr_service/services/distributeddataservice/service/CMakeLists.txt b/datamgr_service/services/distributeddataservice/service/CMakeLists.txt index c04eacd4..c3b35f45 100644 --- a/datamgr_service/services/distributeddataservice/service/CMakeLists.txt +++ b/datamgr_service/services/distributeddataservice/service/CMakeLists.txt @@ -12,6 +12,7 @@ set(MOCK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../mock") set(KV_STORE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../kv_store") aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/backup/src serviceSrc) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/bootstrap/src serviceSrc) +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/cloud serviceSrc) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/config/src serviceSrc) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/config/src/model serviceSrc) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/crypto/src serviceSrc) diff --git a/mock/innerkits/access_token/libaccesstoken_sdk/include/access_token.h b/mock/innerkits/access_token/libaccesstoken_sdk/include/access_token.h index 383cd6c7..b7ae3433 100644 --- a/mock/innerkits/access_token/libaccesstoken_sdk/include/access_token.h +++ b/mock/innerkits/access_token/libaccesstoken_sdk/include/access_token.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,41 +13,83 @@ * limitations under the License. */ -#ifndef ACCESS_TOKEN_DEF_H -#define ACCESS_TOKEN_DEF_H +/** + * @addtogroup AccessToken + * @{ + * + * @brief Provides permission management interfaces. + * + * Provides tokenID-based application permission verification mechanism. + * When an application accesses sensitive data or APIs, this module can check + * whether the application has the corresponding permission. Allows applications + * to query their access token information or APL levcels based on token IDs. + * + * @since 7.0 + * @version 7.0 + */ + +/** + * @file access_token.h + * + * @brief Declares typedefs, enums and const values. + * + * @since 7.0 + * @version 7.0 + */ + +#ifndef ACCESS_TOKEN_H +#define ACCESS_TOKEN_H + +#include namespace OHOS { namespace Security { namespace AccessToken { typedef unsigned int AccessTokenID; +typedef uint64_t FullTokenID; typedef unsigned int AccessTokenAttr; static const int DEFAULT_TOKEN_VERSION = 1; -static const int FIRSTCALLER_TOKENID_DEFAULT = 0; -static const int MAX_PERMISSION_SIZE = 1000; -static const int MAX_NATIVE_TOKEN_INFO_SIZE = 20480; -static const int INVALID_TOKENID = 0; -static const int INVALID_DLP_TOKEN_FLAG = -1; +static const AccessTokenID INVALID_TOKENID = 0; +/** + * @brief Access token kit return code + */ enum AccessTokenKitRet { RET_FAILED = -1, RET_SUCCESS = 0, }; +/** + * @brief AccessTokenID 32 bits map + */ typedef struct { unsigned int tokenUniqueID : 20; + /** reserved, default 000000 */ unsigned int res : 6; unsigned int dlpFlag : 1; + /** + * token type, for details about the valid values, + * see the definition of ATokenTypeEnum in the access_token.h file. + */ unsigned int type : 2; + /** version, default 001 */ unsigned int version : 3; } AccessTokenIDInner; +/** + * @brief Token id type + */ typedef enum TypeATokenTypeEnum { TOKEN_INVALID = -1, TOKEN_HAP = 0, TOKEN_NATIVE, TOKEN_SHELL, + TOKEN_TYPE_BUTT, } ATokenTypeEnum; +/** + * @brief Apl level + */ typedef enum TypeATokenAplEnum { APL_INVALID = 0, APL_NORMAL = 1, @@ -55,45 +97,103 @@ typedef enum TypeATokenAplEnum { APL_SYSTEM_CORE = 3, } ATokenAplEnum; +/** + * @brief Token id full definition + */ typedef union { unsigned long long tokenIDEx; struct { AccessTokenID tokenID; + /** tokenID attribute */ AccessTokenAttr tokenAttr; } tokenIdExStruct; } AccessTokenIDEx; +/** + * @brief Permission states + */ typedef enum TypePermissionState { PERMISSION_DENIED = -1, PERMISSION_GRANTED = 0, } PermissionState; +/** + * @brief Permission grant mode + */ typedef enum TypeGrantMode { + /** user grant the permisson by dynamic pop-up window */ USER_GRANT = 0, + /** + * system grant the permission automated when + * the permission is decleared and app is installed + */ SYSTEM_GRANT = 1, } GrantMode; +/** + * @brief Permission flag + */ typedef enum TypePermissionFlag { + /** + * permission has not been set by user. + */ PERMISSION_DEFAULT_FLAG = 0, + /** + * permission has been set by user, If the permission is not granted, + * a permission window is allowed to apply for permission. + */ PERMISSION_USER_SET = 1 << 0, + /** + * permission has been set by user, If the permission is not granted, + * a permission window is not allowed to apply for permission. + */ PERMISSION_USER_FIXED = 1 << 1, + /** + * permission has been set by system, + * the permission can be a user_grant one which is granted for pre-authorization and is non-cancellable. + */ PERMISSION_SYSTEM_FIXED = 1 << 2, + /** + * a user_grant permission has been set by system for pre-authorization, + * and it is cancellable. it always works with other flags. + */ PERMISSION_GRANTED_BY_POLICY = 1 << 3, + /** + * permission has been set by security component. + */ + PERMISSION_COMPONENT_SET = 1 << 4, + /* + * permission is fixed by policy and the permission cannot be granted or revoked by user + */ + PERMISSION_POLICY_FIXED = 1 << 5, } PermissionFlag; +/** + * @brief Permission operate result + */ typedef enum TypePermissionOper { + /** permission has been set, only can change it in settings */ SETTING_OPER = -1, + /** operate is passed, no need to do anything */ PASS_OPER = 0, + /** permission need dynamic pop-up windows to grant it */ DYNAMIC_OPER = 1, + /** invalid operation, something is wrong, see in md files */ INVALID_OPER = 2, } PermissionOper; +/** + * @brief Dlp types + */ typedef enum DlpType { DLP_COMMON = 0, DLP_READ = 1, DLP_FULL_CONTROL = 2, } HapDlpType; +/** + * @brief Dlp permission type + */ typedef enum TypeDlpPerm { DLP_PERM_ALL = 0, DLP_PERM_FULL_CONTROL = 1, @@ -102,4 +202,4 @@ typedef enum TypeDlpPerm { } // namespace AccessToken } // namespace Security } // namespace OHOS -#endif // ACCESS_TOKEN_DEF_H +#endif // ACCESS_TOKEN_H diff --git a/mock/innerkits/access_token/libaccesstoken_sdk/include/access_token_error.h b/mock/innerkits/access_token/libaccesstoken_sdk/include/access_token_error.h new file mode 100644 index 00000000..b7c9337d --- /dev/null +++ b/mock/innerkits/access_token/libaccesstoken_sdk/include/access_token_error.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup AccessToken + * @{ + * + * @brief Provides permission management interfaces. + * + * Provides tokenID-based application permission verification mechanism. + * When an application accesses sensitive data or APIs, this module can check + * whether the application has the corresponding permission. Allows applications + * to query their access token information or APL levcels based on token IDs. + * + * @since 7.0 + * @version 7.0 + */ + +/** + * @file access_token_error.h + * + * @brief Declares error numbers. + * + * @since 7.0 + * @version 7.0 + */ + +#ifndef ACCESS_TOKEN_ERROR_H +#define ACCESS_TOKEN_ERROR_H + +namespace OHOS { +namespace Security { +namespace AccessToken { +/** + * @brief error numbers + */ +enum AccessTokenError { + ERR_PERMISSION_DENIED = 201, + ERR_NOT_SYSTEM_APP = 202, + ERR_PARAM_INVALID = 12100001, + ERR_TOKENID_NOT_EXIST, + ERR_PERMISSION_NOT_EXIST, + ERR_INTERFACE_NOT_USED_TOGETHER, + ERR_EXCEEDED_MAXNUM_REGISTRATION_LIMIT, + ERR_PERMISSION_OPERATE_FAILED, + ERR_SA_WORK_ABNORMAL, + ERR_MALLOC_FAILED, + ERR_OVERSIZE, + ERR_READ_PARCEL_FAILED, + ERR_WRITE_PARCEL_FAILED, + ERR_DEVICE_NOT_EXIST, + ERR_PROCESS_NOT_EXIST, + ERR_CHECK_DCAP_FAIL, +}; +} // namespace AccessToken +} // namespace Security +} // namespace OHOS + +#endif // ACCESS_TOKEN_ERROR_H \ No newline at end of file diff --git a/mock/innerkits/access_token/libaccesstoken_sdk/include/accesstoken_kit.h b/mock/innerkits/access_token/libaccesstoken_sdk/include/accesstoken_kit.h index 246fb922..973bd58a 100644 --- a/mock/innerkits/access_token/libaccesstoken_sdk/include/accesstoken_kit.h +++ b/mock/innerkits/access_token/libaccesstoken_sdk/include/accesstoken_kit.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,6 +13,30 @@ * limitations under the License. */ +/** + * @addtogroup AccessToken + * @{ + * + * @brief Provides permission management. + * + * Provides tokenID-based application permission verification mechanism. + * When an application accesses sensitive data or APIs, this module can check + * whether the application has the corresponding permission. Allows applications + * to query their access token information or APL levcels based on token IDs. + * + * @since 7.0 + * @version 7.0 + */ + +/** + * @file accesstoken_kit.h + * + * @brief Declares access token interfaces. + * + * @since 7.0 + * @version 7.0 + */ + #ifndef INTERFACES_INNER_KITS_ACCESSTOKEN_KIT_H #define INTERFACES_INNER_KITS_ACCESSTOKEN_KIT_H @@ -32,50 +56,273 @@ namespace OHOS { namespace Security { namespace AccessToken { +/** + * @brief Declares AccessTokenKit class + */ class AccessTokenKit { public: + /** + * @brief Create a unique hap token by input values. + * @param info struct HapInfoParams quote, see hap_token_info.h + * @param policy struct HapPolicyParams quote, see hap_token_info.h + * @return union AccessTokenIDEx, see access_token.h + */ static AccessTokenIDEx AllocHapToken(const HapInfoParams& info, const HapPolicyParams& policy); + /** + * @brief Create a unique mapping token binding remote tokenID and DeviceID. + * @param remoteDeviceID remote device deviceID + * @param remoteTokenID remote device tokenID + * @return local tokenID which mapped by local token + */ static AccessTokenID AllocLocalTokenID(const std::string& remoteDeviceID, AccessTokenID remoteTokenID); - static int UpdateHapToken(AccessTokenID tokenID, const std::string& appIDDesc, const HapPolicyParams& policy); + /** + * @brief Update hap token info. + * @param tokenIdEx union AccessTokenIDEx quote, see access_token.h + * @param isSystemApp is system app or not + * @param appIDDesc app id description quote + * @param apiVersion app api version + * @param policy struct HapPolicyParams quote, see hap_token_info.h + * @return error code, see access_token_error.h + */ + static int UpdateHapToken(AccessTokenIDEx& tokenIdEx, + bool isSystemApp, const std::string& appIDDesc, int32_t apiVersion, const HapPolicyParams& policy); + /** + * @brief Delete token info. + * @param tokenID token id + * @return error code, see access_token_error.h + */ static int DeleteToken(AccessTokenID tokenID); - /* Get token type by ATM service */ + /** + * @brief Get token type by ATM service. + * @param tokenID token id + * @return token type enum, see access_token.h + */ static ATokenTypeEnum GetTokenType(AccessTokenID tokenID); - /* Get token type from flag in tokenId, which doesn't depend on ATM service */ + /** + * @brief Get token type from flag in tokenId, which doesn't depend on ATM service. + * @param tokenID token id + * @return token type enum, see access_token.h + */ static ATokenTypeEnum GetTokenTypeFlag(AccessTokenID tokenID); + /** + * @brief Get token type by ATM service with uint_64 parameters. + * @param tokenID token id + * @return token type enum, see access_token.h + */ + static ATokenTypeEnum GetTokenType(FullTokenID tokenID); + /** + * @brief Get token type from flag in tokenId, which doesn't depend + * on ATM service, with uint_64 parameters. + * @param tokenID token id + * @return token type enum, see access_token.h + */ + static ATokenTypeEnum GetTokenTypeFlag(FullTokenID tokenID); + /** + * @brief Check native token dcap by token id. + * @param tokenID token id + * @param dcap dcap to be checked + * @return error code, see access_token_error.h + */ static int CheckNativeDCap(AccessTokenID tokenID, const std::string& dcap); - static AccessTokenID GetHapTokenID(int userID, const std::string& bundleName, int instIndex); + /** + * @brief Query hap tokenID by input prarms. + * @param userID user id + * @param bundleName bundle name + * @param instIndex inst index + * @return token id if exsit or 0 if not exsit + */ + static AccessTokenID GetHapTokenID(int32_t userID, const std::string& bundleName, int32_t instIndex); + /** + * @brief Query hap token attribute by input prarms. + * @param userID user id + * @param bundleName bundle name + * @param instIndex inst index + * @return union AccessTokenIDEx, see access_token.h + */ + static AccessTokenIDEx GetHapTokenIDEx(int32_t userID, const std::string& bundleName, int32_t instIndex); + /** + * @brief Get hap token info by token id. + * @param tokenID token id + * @param hapTokenInfoRes HapTokenInfo quote, as query result + * @return error code, see access_token_error.h + */ static int GetHapTokenInfo(AccessTokenID tokenID, HapTokenInfo& hapTokenInfoRes); - static AccessTokenID GetNativeTokenId(const std::string& processName); + /** + * @brief Get native token info by token id. + * @param tokenID token id + * @param nativeTokenInfoRes NativeTokenInfo quote, as query result + * @return error code, see access_token_error.h + */ static int GetNativeTokenInfo(AccessTokenID tokenID, NativeTokenInfo& nativeTokenInfoRes); + /** + * @brief Check if the input tokenID has been granted the input permission. + * @param tokenID token id + * @param permissionName permission to be checked + * @return enum PermissionState, see access_token.h + */ static int VerifyAccessToken(AccessTokenID tokenID, const std::string& permissionName); - static int VerifyNativeToken(AccessTokenID tokenID, const std::string& permissionName); + /** + * @brief Check if the input tokenID has been granted the input permission. + * @param callerTokenID the tokenID of caller native process or hap process + * @param firstTokenID the tokenID of first caller native process or hap process + * @param permissionName permission to be checked + * @return enum PermissionState, see access_token.h + */ static int VerifyAccessToken( AccessTokenID callerTokenID, AccessTokenID firstTokenID, const std::string& permissionName); + /** + * @brief Get permission definition by permission name. + * @param permissionName permission name quote + * @param permissionDefResult PermissionDef quote, as query result + * @return error code, see access_token_error.h + */ static int GetDefPermission(const std::string& permissionName, PermissionDef& permissionDefResult); + /** + * @brief Get all permission definitions by token id. + * @param tokenID token id + * @param permList PermissionDef list quote, as query result + * @return error code, see access_token_error.h + */ static int GetDefPermissions(AccessTokenID tokenID, std::vector& permList); + /** + * @brief Get all requested permission full state by token id and grant mode. + * @param tokenID token id + * @param reqPermList PermissionStateFull list quote, as query result + * @param isSystemGrant grant mode + * @return error code, see access_token_error.h + */ static int GetReqPermissions( AccessTokenID tokenID, std::vector& reqPermList, bool isSystemGrant); - static int GetPermissionFlag(AccessTokenID tokenID, const std::string& permissionName); + /** + * @brief Get permission grant flag + * @param tokenID token id + * @param permissionName permission name quote + * @param flag the permission grant flag, as query result + * @return error code, see access_token_error.h + */ + static int GetPermissionFlag(AccessTokenID tokenID, const std::string& permissionName, int& flag); + /** + * @brief Get requsted permission grant result. + * @param permList PermissionListState list quote, as input and query result + * @return enum PermissionOper, see access_token.h + */ static PermissionOper GetSelfPermissionsState(std::vector& permList); + /** + * @brief Grant input permission to input tokenID with input flag. + * @param tokenID token id + * @param permissionName permission name quote + * @param flag the permission grant flag + * @return error code, see access_token_error.h + */ static int GrantPermission(AccessTokenID tokenID, const std::string& permissionName, int flag); + /** + * @brief Revoke input permission to input tokenID with input flag. + * @param tokenID token id + * @param permissionName permission name quote + * @param flag the permission grant flag + * @return error code, see access_token_error.h + */ static int RevokePermission(AccessTokenID tokenID, const std::string& permissionName, int flag); + /** + * @brief Clear all user granted permissions state in input tokenID. + * @param tokenID token id + * @return error code, see access_token_error.h + */ static int ClearUserGrantedPermissionState(AccessTokenID tokenID); + /** + * @brief Register permission state change callback. + * @param callback smart point of class PermStateChangeCallbackCustomize quote + * @return error code, see access_token_error.h + */ static int32_t RegisterPermStateChangeCallback( const std::shared_ptr& callback); + /** + * @brief Unregister permission state change callback. + * @param callback smart point of class PermStateChangeCallbackCustomize quote + * @return error code, see access_token_error.h + */ static int32_t UnRegisterPermStateChangeCallback(const std::shared_ptr& callback); + /** + * @brief Get current version. + * @return error code, see access_token_error.h + */ + static int32_t GetVersion(void); + /** + * @brief Get hap dlp flag by input tokenID. + * @param tokenID token id + * @return dlp flag in tokenID bitmap, or default -1 + */ static int32_t GetHapDlpFlag(AccessTokenID tokenID); + /** + * @brief Reload native token info. + * @return error code, see access_token_error.h + */ + static int32_t ReloadNativeTokenInfo(); + /** + * @brief Get tokenID by native process name. + * @param processName native process name + * @return token id of native process + */ + static AccessTokenID GetNativeTokenId(const std::string& processName); #ifdef TOKEN_SYNC_ENABLE + /** + * @brief Get remote hap token info by remote token id. + * @param tokenID remote token id + * @param hapSync HapTokenInfoForSync quote, as query result + * @return error code, see access_token_error.h + */ static int GetHapTokenInfoFromRemote(AccessTokenID tokenID, HapTokenInfoForSync& hapSync); + /** + * @brief Get all native token infos. + * @param nativeTokenInfosRes NativeTokenInfoForSync list quote + * as input and query result + * @return error code, see access_token_error.h + */ static int GetAllNativeTokenInfo(std::vector& nativeTokenInfosRes); + /** + * @brief Set remote hap token info with remote deviceID. + * @param deviceID remote deviceID + * @param hapSync hap token info to set + * @return error code, see access_token_error.h + */ static int SetRemoteHapTokenInfo(const std::string& deviceID, const HapTokenInfoForSync& hapSync); + /** + * @brief Set remote native token info list with remote deviceID. + * @param deviceID remote deviceID + * @param nativeTokenInfoList native token info list to set + * @return error code, see access_token_error.h + */ static int SetRemoteNativeTokenInfo(const std::string& deviceID, - std::vector& nativeTokenInfoList); + const std::vector& nativeTokenInfoList); + /** + * @brief Delete remote token by remote deviceID and remote tokenID. + * @param deviceID remote deviceID + * @param tokenID remote tokenID + * @return error code, see access_token_error.h + */ static int DeleteRemoteToken(const std::string& deviceID, AccessTokenID tokenID); + /** + * @brief Get local mapping native tokenID by remote deviceID + * and remote tokenID. + * @param deviceID remote deviceID + * @param tokenID remote tokenID + * @return token id of mapping native tokenID + */ static AccessTokenID GetRemoteNativeTokenID(const std::string& deviceID, AccessTokenID tokenID); + /** + * @brief Delete remote tokens by remote deviceID. + * @param deviceID remote deviceID + * @return error code, see access_token_error.h + */ static int DeleteRemoteDeviceTokens(const std::string& deviceID); #endif - static void DumpTokenInfo(std::string& dumpInfo); + /** + * @brief Dump all token infos in the cache. + * @param tokenID token id, if tokenID is valid, only dump this token info + * @param dumpInfo all token info + */ + static void DumpTokenInfo(AccessTokenID tokenID, std::string& dumpInfo); }; } // namespace AccessToken } // namespace Security diff --git a/mock/innerkits/access_token/libaccesstoken_sdk/include/hap_token_info.h b/mock/innerkits/access_token/libaccesstoken_sdk/include/hap_token_info.h index a4831884..aff6dda5 100644 --- a/mock/innerkits/access_token/libaccesstoken_sdk/include/hap_token_info.h +++ b/mock/innerkits/access_token/libaccesstoken_sdk/include/hap_token_info.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,6 +13,30 @@ * limitations under the License. */ +/** + * @addtogroup AccessToken + * @{ + * + * @brief Provides permission management interfaces. + * + * Provides tokenID-based application permission verification mechanism. + * When an application accesses sensitive data or APIs, this module can check + * whether the application has the corresponding permission. Allows applications + * to query their access token information or APL levcels based on token IDs. + * + * @since 7.0 + * @version 7.0 + */ + +/** + * @file hap_token_info.h + * + * @brief Declares hap token infos. + * + * @since 7.0 + * @version 7.0 + */ + #ifndef ACCESSTOKEN_HAP_TOKEN_INFO_H #define ACCESSTOKEN_HAP_TOKEN_INFO_H @@ -25,40 +49,79 @@ namespace OHOS { namespace Security { namespace AccessToken { +/** + * @brief Declares hap info params class + */ class HapInfoParams final { public: int userID; std::string bundleName; + /** instcance index */ int instIndex; + /** + * dlp type, for details about the valid values, + * see the definition of HapDlpType in the access_token.h file. + */ int dlpType; std::string appIDDesc; + /** which version of the SDK is used to develop the hap */ + int32_t apiVersion; + /** indicates whether the hap is a system app */ + bool isSystemApp; }; +/** + * @brief Declares hap policy params class + */ class HapPolicyParams final { public: + /** + * apl level, for details about the valid values, + * see the definition of ATokenAplEnum in the access_token.h file. + */ ATokenAplEnum apl; std::string domain; std::vector permList; std::vector permStateList; }; +/** + * @brief Declares hap token info class + */ class HapTokenInfo final { public: + /** + * apl level, for details about the valid values, + * see the definition of ATokenAplEnum in the access_token.h file. + */ ATokenAplEnum apl; char ver; int userID; std::string bundleName; + /** which version of the SDK is used to develop this hap */ + int32_t apiVersion; + /** instcance index */ int instIndex; + /** + * dlp type, for details about the valid values, + * see the definition of HapDlpType in the access_token.h file. + */ int dlpType; std::string appID; std::string deviceID; AccessTokenID tokenID; + /** token attribute */ AccessTokenAttr tokenAttr; }; +/** + * @brief Declares hap token info for distributed synchronize class + */ class HapTokenInfoForSync final { public: + /** hap token info */ HapTokenInfo baseInfo; + /** permission state list */ std::vector permStateList; }; } // namespace AccessToken diff --git a/mock/innerkits/access_token/libaccesstoken_sdk/include/native_token_info.h b/mock/innerkits/access_token/libaccesstoken_sdk/include/native_token_info.h index 62811db9..109f2a78 100644 --- a/mock/innerkits/access_token/libaccesstoken_sdk/include/native_token_info.h +++ b/mock/innerkits/access_token/libaccesstoken_sdk/include/native_token_info.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,6 +13,30 @@ * limitations under the License. */ +/** + * @addtogroup AccessToken + * @{ + * + * @brief Provides permission management interfaces. + * + * Provides tokenID-based application permission verification mechanism. + * When an application accesses sensitive data or APIs, this module can check + * whether the application has the corresponding permission. Allows applications + * to query their access token information or APL levcels based on token IDs. + * + * @since 7.0 + * @version 7.0 + */ + +/** + * @file native_token_info.h + * + * @brief Declares native token infos. + * + * @since 7.0 + * @version 7.0 + */ + #ifndef ACCESSTOKEN_NATIVE_TOKEN_INFO_H #define ACCESSTOKEN_NATIVE_TOKEN_INFO_H @@ -24,20 +48,36 @@ namespace OHOS { namespace Security { namespace AccessToken { +/** + * @brief Declares native token info class + */ class NativeTokenInfo final { public: + /** + * apl level, for details about the valid values, + * see the definition of ATokenAplEnum in the access_token.h file. + */ ATokenAplEnum apl; unsigned char ver; + /** native process name */ std::string processName; + /** capsbility list */ std::vector dcap; AccessTokenID tokenID; + /** token attribute */ AccessTokenAttr tokenAttr; + /** native process access control permission list */ std::vector nativeAcls; }; +/** + * @brief Declares native token info for distributed synchronize class + */ class NativeTokenInfoForSync final { public: + /** native token info */ NativeTokenInfo baseInfo; + /** permission state list */ std::vector permStateList; }; } // namespace AccessToken diff --git a/mock/innerkits/access_token/libaccesstoken_sdk/include/perm_state_change_callback_customize.h b/mock/innerkits/access_token/libaccesstoken_sdk/include/perm_state_change_callback_customize.h index 8ef8962c..99546225 100644 --- a/mock/innerkits/access_token/libaccesstoken_sdk/include/perm_state_change_callback_customize.h +++ b/mock/innerkits/access_token/libaccesstoken_sdk/include/perm_state_change_callback_customize.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,6 +13,30 @@ * limitations under the License. */ +/** + * @addtogroup AccessToken + * @{ + * + * @brief Provides permission management interfaces. + * + * Provides tokenID-based application permission verification mechanism. + * When an application accesses sensitive data or APIs, this module can check + * whether the application has the corresponding permission. Allows applications + * to query their access token information or APL levcels based on token IDs. + * + * @since 7.0 + * @version 7.0 + */ + +/** + * @file perm_state_change_callback_customize.h + * + * @brief Declares permission state change callback class. + * + * @since 8.0 + * @version 8.0 + */ + #ifndef INTERFACES_INNER_KITS_PERM_STATE_CALLBACK_CUSTOMIZE_H #define INTERFACES_INNER_KITS_PERM_STATE_CALLBACK_CUSTOMIZE_H @@ -21,17 +45,39 @@ namespace OHOS { namespace Security { namespace AccessToken { +/** + * @brief Declares permission state change callback customize class + */ class PermStateChangeCallbackCustomize { public: + /** + * @brief Constructor without any param. + */ PermStateChangeCallbackCustomize(); + /** + * @brief Constructor with param. + * @param scopeInfo struct PermStateChangeScope quote + */ explicit PermStateChangeCallbackCustomize(const PermStateChangeScope &scopeInfo); + /** + * @brief Destructor without any param. + */ virtual ~PermStateChangeCallbackCustomize(); + /** + * @brief Pure virtual function for callback. + * @param result PermStateChangeInfo quote + */ virtual void PermStateChangeCallback(PermStateChangeInfo& result) = 0; + /** + * @brief Get private variable scopeInfo_. + * @param scopeInfo struct PermStateChangeScope quote as return value + */ void GetScope(PermStateChangeScope &scopeInfo) const; private: + /** private variable struct PermStateChangeScope */ PermStateChangeScope scopeInfo_; }; } // namespace AccessToken diff --git a/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_def.h b/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_def.h index 33539a31..a0796401 100644 --- a/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_def.h +++ b/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_def.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,6 +13,30 @@ * limitations under the License. */ +/** + * @addtogroup AccessToken + * @{ + * + * @brief Provides permission management interfaces. + * + * Provides tokenID-based application permission verification mechanism. + * When an application accesses sensitive data or APIs, this module can check + * whether the application has the corresponding permission. Allows applications + * to query their access token information or APL levcels based on token IDs. + * + * @since 7.0 + * @version 7.0 + */ + +/** + * @file permission_def.h + * + * @brief Declares permission definition. + * + * @since 7.0 + * @version 7.0 + */ + #ifndef INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_DEF_H #define INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_DEF_H @@ -23,13 +47,27 @@ namespace OHOS { namespace Security { namespace AccessToken { +/** + * @brief Declares permission definition class + */ class PermissionDef final { public: + /** permission name */ std::string permissionName; + /** bundle name */ std::string bundleName; + /** + * grant mode, for details about the valid values, + * see the definition of GrantMode in the access_token.h file. + */ int grantMode; - TypeATokenAplEnum availableLevel; + /** which SDK version can use this permission to develop app */ + ATokenAplEnum availableLevel; + /** indicats whether this permission can be access control list permission */ bool provisionEnable; + /** + * indicates whether the distributed scene can use this permission or not + */ bool distributedSceneEnable; std::string label; int labelId; @@ -37,6 +75,9 @@ public: int descriptionId; }; +/** + * @brief Declares permission definition data class + */ class PermissionDefData final { public: AccessTokenID tokenId; diff --git a/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_dlp_mode.h b/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_dlp_mode.h index c635bc9a..358bd022 100644 --- a/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_dlp_mode.h +++ b/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_dlp_mode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,6 +13,30 @@ * limitations under the License. */ +/** + * @addtogroup AccessToken + * @{ + * + * @brief Provides permission management interfaces. + * + * Provides tokenID-based application permission verification mechanism. + * When an application accesses sensitive data or APIs, this module can check + * whether the application has the corresponding permission. Allows applications + * to query their access token information or APL levcels based on token IDs. + * + * @since 7.0 + * @version 7.0 + */ + +/** + * @file permission_dlp_mode.h + * + * @brief Declares permission dlp mode class. + * + * @since 8.0 + * @version 8.0 + */ + #ifndef INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_DLP_MODE_H #define INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_DLP_MODE_H @@ -21,9 +45,16 @@ namespace OHOS { namespace Security { namespace AccessToken { +/** + * @brief Declares permission dlp mode class + */ class PermissionDlpMode final { public: std::string permissionName; + /** + * dlp mode, for details about the valid values, + * see the definition of DlpPermMode in the access_token.h file + */ int32_t dlpMode; }; } // namespace AccessToken diff --git a/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_list_state.h b/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_list_state.h index 0e8787e8..2cbb44c9 100644 --- a/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_list_state.h +++ b/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_list_state.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,6 +13,30 @@ * limitations under the License. */ +/** + * @addtogroup AccessToken + * @{ + * + * @brief Provides permission management interfaces. + * + * Provides tokenID-based application permission verification mechanism. + * When an application accesses sensitive data or APIs, this module can check + * whether the application has the corresponding permission. Allows applications + * to query their access token information or APL levcels based on token IDs. + * + * @since 7.0 + * @version 7.0 + */ + +/** + * @file permission_list_state.h + * + * @brief Declares permission list state class. + * + * @since 8.0 + * @version 8.0 + */ + #ifndef INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_LIST_STATE_H #define INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_LIST_STATE_H @@ -22,9 +46,16 @@ namespace OHOS { namespace Security { namespace AccessToken { +/** + * @brief Declares permission list state class. + */ class PermissionListState final { public: std::string permissionName; + /** + * permission request state, for details about the valid values, + * see the definition of HapDlpType in the access_token.h file. + */ int state; }; } // namespace AccessToken diff --git a/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_state_change_info.h b/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_state_change_info.h index 40c4e6a5..0d5752b4 100644 --- a/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_state_change_info.h +++ b/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_state_change_info.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,6 +13,30 @@ * limitations under the License. */ +/** + * @addtogroup AccessToken + * @{ + * + * @brief Provides permission management interfaces. + * + * Provides tokenID-based application permission verification mechanism. + * When an application accesses sensitive data or APIs, this module can check + * whether the application has the corresponding permission. Allows applications + * to query their access token information or APL levcels based on token IDs. + * + * @since 7.0 + * @version 7.0 + */ + +/** + * @file permission_state_change_info.h + * + * @brief Declares PermStateChangeInfo and PermStateChangeScope struct. + * + * @since 7.0 + * @version 7.0 + */ + #ifndef INTERFACES_INNER_KITS_PERMISSION_STATE_CHANGE_INFO_H #define INTERFACES_INNER_KITS_PERMISSION_STATE_CHANGE_INFO_H @@ -24,17 +48,37 @@ namespace OHOS { namespace Security { namespace AccessToken { +/** define tokenID list max size */ #define TOKENIDS_LIST_SIZE_MAX 1024 +/** define permission list max size */ #define PERMS_LIST_SIZE_MAX 1024 +/** + * @brief Declares permission state change info struct + */ struct PermStateChangeInfo { - int32_t PermStateChangeType; + /** + * permission state change type, for details about the valid values, + * see the definition of ActiveChangeType in the active_change_response_info.h file. + */ + int32_t permStateChangeType; AccessTokenID tokenID; std::string permissionName; }; +/** + * @brief Declares permission state change scope struct + */ struct PermStateChangeScope { + /** + * indicates which tokenID to listen the permission state change, + * empty means listen all tokenIDs in the device + */ std::vector tokenIDs; + /** + * indicates which permission to listen the state change, + * empty means listen all permission state changes in the device + */ std::vector permList; }; } // namespace AccessToken diff --git a/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_state_full.h b/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_state_full.h index be30cb56..73354f87 100644 --- a/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_state_full.h +++ b/mock/innerkits/access_token/libaccesstoken_sdk/include/permission_state_full.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,6 +13,30 @@ * limitations under the License. */ +/** + * @addtogroup AccessToken + * @{ + * + * @brief Provides permission management interfaces. + * + * Provides tokenID-based application permission verification mechanism. + * When an application accesses sensitive data or APIs, this module can check + * whether the application has the corresponding permission. Allows applications + * to query their access token information or APL levcels based on token IDs. + * + * @since 7.0 + * @version 7.0 + */ + +/** + * @file permission_state_full.h + * + * @brief Declares permission state full class. + * + * @since 7.0 + * @version 7.0 + */ + #ifndef INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_STATE_FULL_H #define INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_STATE_FULL_H @@ -22,12 +46,24 @@ namespace OHOS { namespace Security { namespace AccessToken { +/** + * @brief Declares permission state full class + */ class PermissionStateFull final { public: std::string permissionName; + /** indicate whether permission is in common use or not */ bool isGeneral; std::vector resDeviceID; + /** + * permission grant state list, for details about the valid values, + * see the definition of PermissionState in the access_token.h file. + */ std::vector grantStatus; + /** + * permission grant flag list, for details about the valid values, + * see the definition of PermissionFlag in the access_token.h file. + */ std::vector grantFlags; }; } // namespace AccessToken diff --git a/mock/innerkits/access_token/libaccesstoken_sdk/include/tokenid_kit.h b/mock/innerkits/access_token/libaccesstoken_sdk/include/tokenid_kit.h new file mode 100644 index 00000000..1560692d --- /dev/null +++ b/mock/innerkits/access_token/libaccesstoken_sdk/include/tokenid_kit.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TOKENID_KIT_H +#define TOKENID_KIT_H + +#include + +namespace OHOS { +namespace Security { +namespace AccessToken { +class TokenIdKit { +public: + static bool IsSystemAppByFullTokenID(uint64_t tokenId) + { + return true; + } +}; +} // namespace AccessToken +} // namespace Security +} // namespace OHOS +#endif // TOKENID_KIT_H diff --git a/mock/napi/src/js_native_api.h b/mock/napi/src/js_native_api.h index c474debe..5daa20f9 100644 --- a/mock/napi/src/js_native_api.h +++ b/mock/napi/src/js_native_api.h @@ -69,9 +69,6 @@ NAPI_EXTERN napi_status napi_create_array_with_length(napi_env env, NAPI_EXTERN napi_status napi_create_double(napi_env env, double value, napi_value* result); -NAPI_EXTERN napi_status napi_create_double(napi_env env, - double value, - napi_value* result); NAPI_EXTERN napi_status napi_create_int32(napi_env env, int32_t value, napi_value* result); diff --git a/mock/sqlite/include/sqlite3.h b/mock/sqlite/include/sqlite3.h index 020b3ad8..4e484c3d 100644 --- a/mock/sqlite/include/sqlite3.h +++ b/mock/sqlite/include/sqlite3.h @@ -441,38 +441,38 @@ SQLITE_API int sqlite3_exec( ** ** See also: [extended result code definitions] */ -#define SQLITE_OK 0 /* Successful result */ -/* beginning-of-error-codes */ -#define SQLITE_ERROR 1 /* Generic error */ -#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */ -#define SQLITE_PERM 3 /* Access permission denied */ -#define SQLITE_ABORT 4 /* Callback routine requested an abort */ -#define SQLITE_BUSY 5 /* The database file is locked */ -#define SQLITE_LOCKED 6 /* A table in the database is locked */ -#define SQLITE_NOMEM 7 /* A malloc() failed */ -#define SQLITE_READONLY 8 /* Attempt to write a readonly database */ -#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ -#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ -#define SQLITE_CORRUPT 11 /* The database disk image is malformed */ -#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */ -#define SQLITE_FULL 13 /* Insertion failed because database is full */ -#define SQLITE_CANTOPEN 14 /* Unable to open the database file */ -#define SQLITE_PROTOCOL 15 /* Database lock protocol error */ -#define SQLITE_EMPTY 16 /* Internal use only */ -#define SQLITE_SCHEMA 17 /* The database schema changed */ -#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ -#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */ -#define SQLITE_MISMATCH 20 /* Data type mismatch */ -#define SQLITE_MISUSE 21 /* Library used incorrectly */ -#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ -#define SQLITE_AUTH 23 /* Authorization denied */ -#define SQLITE_FORMAT 24 /* Not used */ -#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ -#define SQLITE_NOTADB 26 /* File opened that is not a database file */ +#define SQLITE_OK 0 /* 成功 | Successful result */ +/* 错误码开始 */ +#define SQLITE_ERROR 1 /* SQL错误 或 丢失数据库 | SQL error or missing database */ +#define SQLITE_INTERNAL 2 /* SQLite 内部逻辑错误 | Internal logic error in SQLite */ +#define SQLITE_PERM 3 /* 拒绝访问 | Access permission denied */ +#define SQLITE_ABORT 4 /* 回调函数请求取消操作 | Callback routine requested an abort */ +#define SQLITE_BUSY 5 /* 数据库文件被锁定 | The database file is locked */ +#define SQLITE_LOCKED 6 /* 数据库中的一个表被锁定 | A table in the database is locked */ +#define SQLITE_NOMEM 7 /* 某次 malloc() 函数调用失败 | A malloc() failed */ +#define SQLITE_READONLY 8 /* 尝试写入一个只读数据库 | Attempt to write a readonly database */ +#define SQLITE_INTERRUPT 9 /* 操作被 sqlite3_interupt() 函数中断 | Operation terminated by sqlite3_interrupt() */ +#define SQLITE_IOERR 10 /* 发生某些磁盘 I/O 错误 | Some kind of disk I/O error occurred */ +#define SQLITE_CORRUPT 11 /* 数据库磁盘映像不正确 | The database disk image is malformed */ +#define SQLITE_NOTFOUND 12 /* sqlite3_file_control() 中出现未知操作数 | Unknown opcode in sqlite3_file_control() */ +#define SQLITE_FULL 13 /* 因为数据库满导致插入失败 | Insertion failed because database is full */ +#define SQLITE_CANTOPEN 14 /* 无法打开数据库文件 | Unable to open the database file */ +#define SQLITE_PROTOCOL 15 /* 数据库锁定协议错误 | Database lock protocol error */ +#define SQLITE_EMPTY 16 /* 数据库为空 | Database is empty */ +#define SQLITE_SCHEMA 17 /* 数据结构发生改变 | The database schema changed */ +#define SQLITE_TOOBIG 18 /* 字符串或二进制数据超过大小限制 | String or BLOB exceeds size limit */ +#define SQLITE_CONSTRAINT 19 /* 由于约束违例而取消 | Abort due to constraint violation */ +#define SQLITE_MISMATCH 20 /* 数据类型不匹配 | Data type mismatch */ +#define SQLITE_MISUSE 21 /* 不正确的库使用 | Library used incorrectly */ +#define SQLITE_NOLFS 22 /* 使用了操作系统不支持的功能 | Uses OS features not supported on host */ +#define SQLITE_AUTH 23 /* 授权失败 | Authorization denied */ +#define SQLITE_FORMAT 24 /* 附加数据库格式错误 | Auxiliary database format error */ +#define SQLITE_RANGE 25 /* 传递给sqlite3_bind()的第二个参数超出范围 | 2nd parameter to sqlite3_bind out of range */ +#define SQLITE_NOTADB 26 /* 被打开的文件不是一个数据库文件 | File opened that is not a database file */ #define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */ #define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */ -#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */ -#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */ +#define SQLITE_ROW 100 /* sqlite3_step() 已经产生一个行结果 | sqlite3_step() has another row ready */ +#define SQLITE_DONE 101 /* sqlite3_step() 完成执行操作 | sqlite3_step() has finished executing */ /* end-of-error-codes */ /* diff --git a/mock/src/mock_ipc.cpp b/mock/src/mock_ipc.cpp index 2adf8fc8..bb3aacdc 100644 --- a/mock/src/mock_ipc.cpp +++ b/mock/src/mock_ipc.cpp @@ -122,10 +122,22 @@ uint32_t IPCSkeleton::GetCallingTokenID() params.aplStr = "distributed_test"; return GetAccessTokenId(¶ms); } +uint64_t IPCSkeleton::GetCallingFullTokenID() +{ + NativeTokenInfoParams params{0}; + params.processName = "distributed_test"; + params.aplStr = "distributed_test"; + return GetAccessTokenId(¶ms); +} + uint64_t IPCSkeleton::GetSelfTokenID() { - return 0; + NativeTokenInfoParams params{0}; + params.processName = "distributed_test"; + params.aplStr = "distributed_test"; + return GetAccessTokenId(¶ms); } + std::string IPCSkeleton::ResetCallingIdentity() { return ""; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c535ed67..8be41434 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -29,6 +29,7 @@ aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../kv_store/frameworks/innerkit aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../kv_store/frameworks/common/test remoteTestSrc) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../kv_store/frameworks/innerkitsimpl/distributeddatafwk/test/unittest remoteTestSrc) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/distributeddataservice/framework/test localTestSrc) +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/distributeddataservice/adapter/account/test remoteTestSrc) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/distributeddataservice/adapter/communicator/test/unittest remoteTestSrc) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/distributeddataservice/service/test/mock remoteTestSrc) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/distributeddataservice/service/test remoteTestSrc) -- Gitee