diff --git a/api/@ohos.ability.wantConstant.d.ts b/api/@ohos.ability.wantConstant.d.ts index 977adac91875099dcf25d1d7f50caf2db4833636..a0483c0095fcfbf5e8e4f9234deda55e593836a7 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 0000000000000000000000000000000000000000..b7ab2495de5463b1beac842e0f39bd08d2f58482 --- /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; +}