From d9032ea9d1a94650c128a404e4652c5671d8833a Mon Sep 17 00:00:00 2001 From: altay Date: Fri, 28 Jan 2022 16:01:24 +0800 Subject: [PATCH] fixed 618fbd2 from https://gitee.com/altay/interface_sdk-js/pulls/479 Description:add verifyUriPermission interface Sig:SIG_ApplicationFramework Feature or Bugfix:Feature Binary Source:No Signed-off-by: altay Change-Id: I0988fb52d5f344fff8be9c260824fbc8b775cfe5 --- api/@ohos.ability.wantConstant.d.ts | 4 --- api/application/UriPermissionManager.d.ts | 39 +++++++++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 api/application/UriPermissionManager.d.ts diff --git a/api/@ohos.ability.wantConstant.d.ts b/api/@ohos.ability.wantConstant.d.ts index 977adac918..a0483c0095 100644 --- a/api/@ohos.ability.wantConstant.d.ts +++ b/api/@ohos.ability.wantConstant.d.ts @@ -262,15 +262,11 @@ declare namespace wantConstant { export enum Flags { /** * Indicates the grant to perform read operations on the URI. - * - * @hide */ FLAG_AUTH_READ_URI_PERMISSION = 0x00000001, /** * Indicates the grant to perform write operations on the URI. - * - * @hide */ FLAG_AUTH_WRITE_URI_PERMISSION = 0x00000002, diff --git a/api/application/UriPermissionManager.d.ts b/api/application/UriPermissionManager.d.ts new file mode 100644 index 0000000000..b7ab2495de --- /dev/null +++ b/api/application/UriPermissionManager.d.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 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. + */ + +import { AsyncCallback } from "../basic"; +import wantConstant from "../@ohos.ability.wantConstant"; + +/** + * The management class for uri of file. + * + * @since 9 + * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @permission N/A + */ +export default class UriPermissionManager { + /** + * Check whether the application corresponding to the accesstokenID has access rights to the URI. + * + * @since 9 + * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @param uri File URI. + * @param flag wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION or wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION + * @param accessTokenId Indicates the access token of the application. + * @return Returns 0 if the verification is successful, otherwise returns -1. + */ + verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number, callback: AsyncCallback): void; + verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise; +} -- Gitee