fix:Modify token permission calc get system app type

Signed-off-by: wangxin <wangxin617@huawei.com>
This commit is contained in:
wangxin 2024-09-05 10:27:41 +00:00
parent d77b7ffeb5
commit 8c6c9cf240
2 changed files with 5 additions and 4 deletions

View File

@ -27,6 +27,7 @@
#include "softbus_def.h"
#include "softbus_errcode.h"
#include "system_ability_definition.h"
#include "tokenid_kit.h"
#include "trans_session_manager.h"
namespace {
@ -67,10 +68,9 @@ static int32_t CalcPermType(pid_t callingUid, pid_t callingPid)
if (tokenType == ATokenTypeEnum::TOKEN_NATIVE) {
return NATIVE_APP;
} else if (tokenType == ATokenTypeEnum::TOKEN_HAP) {
HapTokenInfo hapTokenInfo;
AccessTokenKit::GetHapTokenInfo(callingToken, hapTokenInfo);
if ((hapTokenInfo.apl == ATokenAplEnum::APL_SYSTEM_CORE) ||
(hapTokenInfo.apl == ATokenAplEnum::APL_SYSTEM_BASIC)) {
uint64_t accessTokenIDEx = OHOS::IPCSkeleton::GetCallingFullTokenID();
bool isSystemApp = TokenIdKit::IsSystemAppByFullTokenID(accessTokenIDEx);
if (isSystemApp) {
return SYSTEM_APP;
}
}

View File

@ -283,6 +283,7 @@ if (defined(ohos_lite)) {
external_deps += [
"access_token:libaccesstoken_sdk",
"access_token:libprivacy_sdk",
"access_token:libtokenid_sdk",
"device_auth:deviceauth_sdk",
"hilog:libhilog",
"ipc:ipc_core",