mirror of
https://github.com/openharmony/distributedschedule_samgr.git
synced 2026-07-21 06:55:27 -04:00
!142 distributed permission check
Merge pull request !142 from zhangmingxiang/0215
This commit is contained in:
@@ -125,7 +125,7 @@ bool DistributedSchedPermission::CheckCustomPermission(const AppExecFwk::Ability
|
||||
HILOGI("[PerformanceTest] AllocLocalTokenID spend %{public}" PRId64 " ms", GetTickCount() - begin);
|
||||
if (dAccessToken == 0) {
|
||||
HILOGE("dAccessTokenID is invalid!");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
for (const auto& permission : permissions) {
|
||||
if (permission.empty()) {
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "iservice_registry.h"
|
||||
#include "mission/distributed_mission_info.h"
|
||||
#include "mission/distributed_sched_mission_manager.h"
|
||||
#include "os_account_manager.h"
|
||||
#include "parcel_helper.h"
|
||||
#include "string_ex.h"
|
||||
#include "system_ability_definition.h"
|
||||
@@ -42,6 +43,7 @@
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
using namespace AAFwk;
|
||||
using namespace AccountSA;
|
||||
using namespace AppExecFwk;
|
||||
|
||||
namespace {
|
||||
@@ -161,7 +163,12 @@ int32_t DistributedSchedService::StartAbilityFromRemote(const OHOS::AAFwk::Want&
|
||||
HILOGE("connect ability server failed %{public}d", err);
|
||||
return err;
|
||||
}
|
||||
err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, requestCode);
|
||||
std::vector<int> ids;
|
||||
ErrCode ret = OsAccountManager::QueryActiveOsAccountIds(ids);
|
||||
if (ret != ERR_OK || ids.empty()) {
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, requestCode, ids[0]);
|
||||
if (err != ERR_OK) {
|
||||
HILOGE("StartAbility failed %{public}d", err);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ bool DistributedDataStorage::Init()
|
||||
HILOGE("InitKvDataService failed!");
|
||||
return false;
|
||||
}
|
||||
HILOGD("Init success!");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -165,6 +165,7 @@ ohos_unittest("dscheddatastoragetest") {
|
||||
external_deps = dsched_external_deps
|
||||
public_deps = dsched_public_deps
|
||||
}
|
||||
part_name = "dmsfwk_standard"
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
||||
@@ -178,7 +178,7 @@ HWTEST_F(DistributedSchedPermissionTest, CheckDPermission_006, TestSize.Level1)
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000GK79E
|
||||
*/
|
||||
HWTEST_F(DistributedSchedPermissionTest, CheckDPermission_007, TestSize.Level0)
|
||||
HWTEST_F(DistributedSchedPermissionTest, CheckDPermission_007, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedPermissionTest CheckDPermission_007 begin" << std::endl;
|
||||
AAFwk::Want want;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace {
|
||||
constexpr int32_t TASK_ID_1 = 11;
|
||||
constexpr int32_t TASK_ID_2 = 12;
|
||||
constexpr size_t BYTESTREAM_LENGTH = 100;
|
||||
constexpr uint8_t BYTE = '6';
|
||||
constexpr uint8_t ONE_BYTE = '6';
|
||||
}
|
||||
|
||||
void DistributedDataStorageTest::SetUpTestCase()
|
||||
@@ -57,7 +57,7 @@ uint8_t* DistributedDataStorageTest::InitByteStream()
|
||||
{
|
||||
uint8_t* byteStream = new uint8_t[BYTESTREAM_LENGTH];
|
||||
for (size_t i = 0; i < BYTESTREAM_LENGTH; ++i) {
|
||||
byteStream[i] = BYTE;
|
||||
byteStream[i] = ONE_BYTE;
|
||||
}
|
||||
return byteStream;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user