提交 b32f3d82 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 62e42ae3
...@@ -237,7 +237,7 @@ ...@@ -237,7 +237,7 @@
- [@ohos.file.environment (Directory Environment Capability)](js-apis-file-environment.md) - [@ohos.file.environment (Directory Environment Capability)](js-apis-file-environment.md)
- [@ohos.file.fileAccess (User File Access and Management)](js-apis-fileAccess.md) - [@ohos.file.fileAccess (User File Access and Management)](js-apis-fileAccess.md)
- [@ohos.file.fileExtensionInfo (User File Extension Information)](js-apis-fileExtensionInfo.md) - [@ohos.file.fileExtensionInfo (User File Extension Information)](js-apis-fileExtensionInfo.md)
- [@ohos.file.fileUri (File URI)](js-apis-file-fileUri.md) - [@ohos.file.fileuri (File URI)](js-apis-file-fileuri.md)
- [@ohos.file.fs (File Management)](js-apis-file-fs.md) - [@ohos.file.fs (File Management)](js-apis-file-fs.md)
- [@ohos.file.hash (File Hash Processing)](js-apis-file-hash.md) - [@ohos.file.hash (File Hash Processing)](js-apis-file-hash.md)
- [@ohos.file.picker (File Picker)](js-apis-file-picker.md) - [@ohos.file.picker (File Picker)](js-apis-file-picker.md)
......
# @ohos.application.uriPermissionManager (URI Permission Management)
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The **uriPermissionManager** module provides APIs for granting permissions on a file to or revoking the granted permission from an application. The file is identified by a uniform resource identifier (URI).
## Modules to Import
```js
import UriPermissionManager from '@ohos.application.uriPermissionManager';
```
## uriPermissionManager.grantUriPermission
grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number, callback: AsyncCallback&lt;number&gt;): void
Grants permission on the file of the specified URI to an application. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| uri | string | Yes| URI of the file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.|
| flag | [wantConstant.Flags](js-apis-ability-wantConstant.md#wantconstantflags) | Yes| Read or write permission on the file to grant.|
| targetBundleName | string | Yes| Bundle name of the application, to which the permission is granted.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the result. If the operation is successful, **0** is returned; otherwise, **-1** is returned.|
**Example**
```js
import WantConstant from '@ohos.ability.wantConstant';
let targetBundleName = 'com.example.test_case1'
let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10"
uriPermissionManager.grantUriPermission(uri, WantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, targetBundleName, (result) => {
console.log("result.code = " + result.code)
})
```
## uriPermissionManager.grantUriPermission
grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise&lt;number&gt;
Grants permission on the file of the specified URI to an application. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| uri | string | Yes| URI of the file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.|
| flag | [wantConstant.Flags](js-apis-ability-wantConstant.md#wantconstantflags) | Yes| Read or write permission on the file to grant.|
| targetBundleName | string | Yes| Bundle name of the application, to which the permission is granted.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the result. If the operation is successful, **0** is returned; otherwise, **-1** is returned.|
**Example**
```js
import WantConstant from '@ohos.ability.wantConstant';
let targetBundleName = 'com.example.test_case1'
let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10"
uriPermissionManager.grantUriPermission(uri, wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, targetBundleName)
.then((data) => {
console.log('Verification succeeded.' + data)
}).catch((error) => {
console.log('Verification failed.');
})
```
## uriPermissionManager.revokeUriPermission
revokeUriPermission(uri: string, accessTokenId: number, callback: AsyncCallback&lt;number&gt;): void
Revokes the permission on the file of the specified URI from an application. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| uri | string | Yes| URI of the file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.|
| targetBundleName | string | Yes| Bundle name of the application, from which the permission is revoked.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the result. If the operation is successful, **0** is returned; otherwise, **-1** is returned.|
**Example**
```js
import WantConstant from '@ohos.ability.wantConstant';
let targetBundleName = 'com.example.test_case1'
let URI = "fileshare:///com.samples.filesharetest.FileShare/person/10"
uriPermissionManager.revokeUriPermission(uri, targetBundleName, (result) => {
console.log("result.code = " + result.code)
})
```
## uriPermissionManager.revokeUriPermission
revokeUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise&lt;number&gt;
Revokes the permission on the file of the specified URI from an application. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| uri | string | Yes| URI of the file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.|
| targetBundleName | string | Yes| Bundle name of the application, from which the permission is revoked.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the result. If the operation is successful, **0** is returned; otherwise, **-1** is returned.|
**Example**
```js
import WantConstant from '@ohos.ability.wantConstant';
let targetBundleName = 'com.example.test_case1'
let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10"
uriPermissionManager.revokeUriPermission(uri, targetBundleName)
.then((data) => {
console.log('Verification succeeded.' + data)
}).catch((error) => {
console.log('Verification failed.');
})
```
...@@ -436,7 +436,7 @@ Allows an application to obtain the sensitive permissions that have been granted ...@@ -436,7 +436,7 @@ Allows an application to obtain the sensitive permissions that have been granted
## ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION ## ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
Allows an application to set attributes for the applications of other users. Allows an application to set the attributes of applications of other users.
**Permission level**: system_core **Permission level**: system_core
...@@ -496,7 +496,7 @@ Allows an application to read data from a gyroscope sensor or uncalibrated gyros ...@@ -496,7 +496,7 @@ Allows an application to read data from a gyroscope sensor or uncalibrated gyros
## ohos.permission.INSTALL_BUNDLE ## ohos.permission.INSTALL_BUNDLE
Allows an application to install and uninstall other applications. Allows an application to install and uninstall other applications (except enterprise InHouse applications).
**Permission level**: system_core **Permission level**: system_core
...@@ -974,6 +974,26 @@ Allows the device administrator to set bundle installation policies. ...@@ -974,6 +974,26 @@ Allows the device administrator to set bundle installation policies.
**Enable via ACL**: TRUE **Enable via ACL**: TRUE
## ohos.permission.ENTERPRISE_SET_NETWORK
Allows the device administrator application to set network information.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
## ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
Allows the device administrator application to set application running policies.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
## ohos.permission.NFC_TAG ## ohos.permission.NFC_TAG
Allows an application to read NFC tag information. Allows an application to read NFC tag information.
...@@ -1146,7 +1166,7 @@ Allows an application to add, remove, and modify call logs. ...@@ -1146,7 +1166,7 @@ Allows an application to add, remove, and modify call logs.
## ohos.permission.WRITE_CONTACTS ## ohos.permission.WRITE_CONTACTS
Allows an application to add, remove, and modify contacts. Allows an application to add, remove, and modify Contacts.
**Permission level**: system_basic **Permission level**: system_basic
...@@ -1500,7 +1520,7 @@ Allows an application to manage private credentials and query certificate status ...@@ -1500,7 +1520,7 @@ Allows an application to manage private credentials and query certificate status
## ohos.permission.ACCESS_PUSH_SERVICE ## ohos.permission.ACCESS_PUSH_SERVICE
Allows an application to to access the Ability of the push service. Allows an application to access the Ability of the push service.
**Permission level**: system_basic **Permission level**: system_basic
...@@ -1628,6 +1648,26 @@ Allows an application to have backup and restore capabilities. ...@@ -1628,6 +1648,26 @@ Allows an application to have backup and restore capabilities.
**Enable via ACL**: TRUE **Enable via ACL**: TRUE
## ohos.permission.CLOUDFILE_SYNC_MANAGER
Allows an application to obtain the device-cloud synchronization management capability.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
## ohos.permission.CLOUDFILE_SYNC
Allows an application to perform device-cloud synchronization.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
## ohos.permission.FILE_ACCESS_MANAGER ## ohos.permission.FILE_ACCESS_MANAGER
Allows a file management application to access user data files through the FAF. Allows a file management application to access user data files through the FAF.
...@@ -1640,7 +1680,7 @@ Allows a file management application to access user data files through the FAF. ...@@ -1640,7 +1680,7 @@ Allows a file management application to access user data files through the FAF.
## ohos.permission.MANAGE_AUDIO_CONFIG ## ohos.permission.MANAGE_AUDIO_CONFIG
Allows an application to to mute microphones globally. Allows an application to mute microphones globally.
**Permission level**: system_basic **Permission level**: system_basic
...@@ -1757,3 +1797,83 @@ Allows an application to use ultrasonic sensing. ...@@ -1757,3 +1797,83 @@ Allows an application to use ultrasonic sensing.
**Authorization mode**: system_grant **Authorization mode**: system_grant
**Enable ACL**: FALSE **Enable ACL**: FALSE
## ohos.permission.INSTALL_ENTERPRISE_BUNDLE
Allows an application to install and uninstall enterprise InHouse applications.
**Permission level**: system_core
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
## ohos.permission.PROXY_AUTHORIZATION_URI
Allows the application proxy to authorize the URI.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable ACL**: FALSE
## ohos.permission.GET_INSTALLED_BUNDLE_LIST
Allows an application to obtain the list of installed applications.
**Permission level**: system_basic
**Authorization mode**: user_grant
**Enable via ACL**: TRUE
## ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS
Allows an application to manage distributed account information.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
## ohos.permission.GET_DISTRIBUTED_ACCOUNTS
Allows an application to obtain distributed account information.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
## ohos.permission.GET_LOCAL_ACCOUNTS
Allows an application to obtain local account information.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
## ohos.permission.READ_HIVIEW_SYSTEM
Allows an application to access HiView data.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
## ohos.permission.WRITE_HIVIEW_SYSTEM
Allows an application to modify HiView data.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册