!692 权限校验提到前面,保持相同,先校验systemapi限制,再校验access permission

Merge pull request !692 from liuhanxiong/master
This commit is contained in:
openharmony_ci 2023-12-02 15:03:03 +00:00 committed by Gitee
commit b52c132cb8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -579,11 +579,6 @@ int32_t UserAuthService::CheckAuthWidgetParam(
return INVALID_PARAMETERS;
}
if (!IpcCommon::CheckPermission(*this, IS_SYSTEM_APP) &&
(widgetParam.windowMode != WindowModeType::UNKNOWN_WINDOW_MODE)) {
IAM_LOGE("normal app can't set window mode.");
return INVALID_PARAMETERS;
}
if (widgetParam.windowMode == FULLSCREEN && CheckSingeFaceOrFinger(validType)) {
IAM_LOGE("Single fingerprint or single face does not support full screen");
return INVALID_PARAMETERS;
@ -632,6 +627,12 @@ uint64_t UserAuthService::AuthWidget(int32_t apiVersion, const AuthParam &authPa
static_cast<void>(IpcCommon::GetCallerName(*this, isBundleName, callerName));
contextCallback->SetTraceCallerName(callerName);
Attributes extraInfo;
if (!IpcCommon::CheckPermission(*this, IS_SYSTEM_APP) &&
(widgetParam.windowMode != WindowModeType::UNKNOWN_WINDOW_MODE)) {
IAM_LOGE("normal app can't set window mode.");
contextCallback->OnResult(INVALID_PARAMETERS, extraInfo);
return BAD_CONTEXT_ID;
}
if (!IpcCommon::CheckPermission(*this, ACCESS_BIOMETRIC_PERMISSION)) {
IAM_LOGE("CheckPermission failed");
contextCallback->OnResult(CHECK_PERMISSION_FAILED, extraInfo);