From bf8b8355dcfcd0c2a3477b68afb18f8c8997061b Mon Sep 17 00:00:00 2001 From: wan-xiaoqing321 Date: Tue, 5 Aug 2025 10:57:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wan-xiaoqing321 --- .../service/test/udmf_service_impl_test.cpp | 4 ++-- .../distributeddataservice/service/udmf/udmf_service_impl.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/distributeddataservice/service/test/udmf_service_impl_test.cpp b/services/distributeddataservice/service/test/udmf_service_impl_test.cpp index dde641046..9a32e1587 100644 --- a/services/distributeddataservice/service/test/udmf_service_impl_test.cpp +++ b/services/distributeddataservice/service/test/udmf_service_impl_test.cpp @@ -180,7 +180,7 @@ HWTEST_F(UdmfServiceImplTest, Sync001, TestSize.Level1) std::vector devices = {"device1"}; UdmfServiceImpl udmfServiceImpl; int32_t ret = udmfServiceImpl.Sync(query, devices); - EXPECT_EQ(ret, E_INVALID_PARAMETERS); + EXPECT_EQ(ret, E_NO_PERMISSION); } /** @@ -415,7 +415,7 @@ HWTEST_F(UdmfServiceImplTest, SyncTest001, TestSize.Level0) std::vector devices = {"remote_device"}; auto ret = udmfServiceImpl.Sync(query, devices); - EXPECT_EQ(ret, UDMF::E_DB_ERROR); + EXPECT_EQ(ret, UDMF::E_NO_PERMISSION); } /** diff --git a/services/distributeddataservice/service/udmf/udmf_service_impl.cpp b/services/distributeddataservice/service/udmf/udmf_service_impl.cpp index 668f65a0a..770a10c31 100644 --- a/services/distributeddataservice/service/udmf/udmf_service_impl.cpp +++ b/services/distributeddataservice/service/udmf/udmf_service_impl.cpp @@ -626,7 +626,7 @@ int32_t UdmfServiceImpl::AddPrivilege(const QueryOption &query, Privilege &privi int32_t UdmfServiceImpl::Sync(const QueryOption &query, const std::vector &devices) { - if (!UTILS::IsTokenNative() && + if (!UTILS::IsTokenNative() || !DistributedKv::PermissionValidator::GetInstance().CheckSyncPermission(query.tokenId)) { ZLOGE("Tokenid permission verification failed!"); return E_NO_PERMISSION; -- Gitee