From e6e6d21ad9974d52407397c4dc044f070175bc40 Mon Sep 17 00:00:00 2001 From: wangtiantian Date: Tue, 8 Feb 2022 12:09:57 +0800 Subject: [PATCH] IssueNo: #I4SEQE : bms add getPermissionDef Description: add getPermissionDef Sig:SIG_ApplicaitonFramework Feature or Bugfix:BugFix Binary Source:No Signed-off-by: wangtiantian --- api/@ohos.bundle.d.ts | 15 ++++++++++ api/bundle/PermissionDef.d.ts | 52 +++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 api/bundle/PermissionDef.d.ts diff --git a/api/@ohos.bundle.d.ts b/api/@ohos.bundle.d.ts index 88d5361894..0df7273d6f 100644 --- a/api/@ohos.bundle.d.ts +++ b/api/@ohos.bundle.d.ts @@ -22,6 +22,7 @@ import { Want } from './ability/want'; import { BundleInstaller } from './bundle/bundleInstaller'; import { ShortcutInfo } from './bundle/shortcutInfo'; import { ModuleUsageRecord } from './bundle/moduleUsageRecord'; +import { PermissionDef } from './bundle/PermissionDef'; /** * bundle. @@ -609,6 +610,20 @@ declare namespace bundle { function queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId: number, callback: AsyncCallback>): void; function queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, callback: AsyncCallback>): void; function queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId?: number): Promise>; + + /** + * Get the permission details by permissionName. + * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Appexecfwk + * @param permissionName Indicates permission name. + * @return Returns permissionDef object. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @systemapi + */ + function getPermissionDef(permissionName: string, callback: AsyncCallback): void; + function getPermissionDef(permissionName: string): Promise; } export default bundle; \ No newline at end of file diff --git a/api/bundle/PermissionDef.d.ts b/api/bundle/PermissionDef.d.ts new file mode 100644 index 0000000000..68f50051a1 --- /dev/null +++ b/api/bundle/PermissionDef.d.ts @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2021 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. + */ + +/** + * @name Indicates the defined permission details in file config.json + * @since 8 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + * @systemapi + */ + export interface PermissionDef { + /** + * @default Indicates the name of this permission + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + permissionName: string; + + /** + * @default Indicates the bundleName of this permission + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + bundleName: string; + + /** + * @default Indicates the labelId of this permission + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + labelId: number; + + /** + * @default Indicates the descriptionId of this permission + * @since 8 + * @SysCap SystemCapability.Appexecfwk + */ + descriptionId: number; +} -- Gitee