mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-27 17:31:12 +00:00
支持权限跨平台标记
Signed-off-by: chennian <chennian1@huawei.com>
This commit is contained in:
parent
30eb9b9f8c
commit
612a6b0aee
68
api/@ohos.abilityAccessCtrl.d.ts
vendored
68
api/@ohos.abilityAccessCtrl.d.ts
vendored
@ -31,6 +31,14 @@ declare namespace abilityAccessCtrl {
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @since 8
|
||||
*/
|
||||
/**
|
||||
* Obtains the AtManager instance.
|
||||
*
|
||||
* @returns { AtManager } returns the instance of the AtManager.
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
*/
|
||||
function createAtManager(): AtManager;
|
||||
|
||||
/**
|
||||
@ -89,8 +97,34 @@ declare namespace abilityAccessCtrl {
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @since 9
|
||||
*/
|
||||
/**
|
||||
* Checks whether a specified application has been granted the given permission.
|
||||
*
|
||||
* @param { number } tokenID The tokenId of specified application.
|
||||
* @param { Permissions } permissionName The permission name to be verified.
|
||||
* @returns { Promise<GrantStatus> } Returns permission verify result.
|
||||
* @throws { BusinessError } 401 - The parameter check failed.
|
||||
* @throws { BusinessError } 12100001 - The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256.
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
*/
|
||||
checkAccessToken(tokenID: number, permissionName: Permissions): Promise<GrantStatus>;
|
||||
|
||||
/**
|
||||
* Checks whether a specified application has been granted the given permission.
|
||||
*
|
||||
* @param { number } tokenID The tokenId of specified application.
|
||||
* @param { Permissions } permissionName The permission name to be verified.
|
||||
* @returns { GrantStatus } Returns permission verify result.
|
||||
* @throws { BusinessError } 401 - The parameter check failed.
|
||||
* @throws { BusinessError } 12100001 - The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256.
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
*/
|
||||
checkAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus;
|
||||
|
||||
/**
|
||||
* Requests certain permissions from the user.
|
||||
*
|
||||
@ -103,6 +137,19 @@ declare namespace abilityAccessCtrl {
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
*/
|
||||
/**
|
||||
* Requests certain permissions from the user.
|
||||
*
|
||||
* @param { Context } context The context that initiates the permission request.
|
||||
* @param { Array<Permissions> } permissionList Indicates the list of permissions to be requested. This parameter cannot be null or empty.
|
||||
* @param { AsyncCallback<PermissionRequestResult> } requestCallback Callback for the result from requesting permissions.
|
||||
* @throws { BusinessError } 401 - The parameter check failed.
|
||||
* @throws { BusinessError } 12100001 - The parameter is invalid. The context is invalid when it does not belong to the application itself.
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @StageModelOnly
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
*/
|
||||
requestPermissionsFromUser(
|
||||
context: Context,
|
||||
permissionList: Array<Permissions>,
|
||||
@ -121,6 +168,19 @@ declare namespace abilityAccessCtrl {
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
*/
|
||||
/**
|
||||
* Requests certain permissions from the user.
|
||||
*
|
||||
* @param { Context } context The context that initiates the permission request.
|
||||
* @param { Array<Permissions> } permissionList Indicates the list of permissions to be requested. This parameter cannot be null or empty.
|
||||
* @returns { Promise<PermissionRequestResult> } Returns result of requesting permissions.
|
||||
* @throws { BusinessError } 401 - The parameter check failed.
|
||||
* @throws { BusinessError } 12100001 - The parameter is invalid. The context is invalid when it does not belong to the application itself.
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @StageModelOnly
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
*/
|
||||
requestPermissionsFromUser(context: Context, permissionList: Array<Permissions>): Promise<PermissionRequestResult>;
|
||||
|
||||
/**
|
||||
@ -332,6 +392,14 @@ declare namespace abilityAccessCtrl {
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @since 8
|
||||
*/
|
||||
/**
|
||||
* GrantStatus.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
*/
|
||||
export enum GrantStatus {
|
||||
/**
|
||||
* access_token permission check fail
|
||||
|
32
api/security/PermissionRequestResult.d.ts
vendored
Executable file → Normal file
32
api/security/PermissionRequestResult.d.ts
vendored
Executable file → Normal file
@ -16,18 +16,33 @@
|
||||
/**
|
||||
* The result of requestPermissionsFromUser with asynchronous callback.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @permission N/A
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
*/
|
||||
/**
|
||||
* The result of requestPermissionsFromUser with asynchronous callback.
|
||||
*
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @StageModelOnly
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
*/
|
||||
export default class PermissionRequestResult {
|
||||
/**
|
||||
* The permissions passed in by the user.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
*/
|
||||
/**
|
||||
* The permissions passed in by the user.
|
||||
*
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @StageModelOnly
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
*/
|
||||
permissions: Array<string>;
|
||||
|
||||
@ -35,9 +50,18 @@ export default class PermissionRequestResult {
|
||||
* The results for the corresponding request permissions. The value 0 indicates that a
|
||||
* permission is granted, and the value -1 indicates not.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
*/
|
||||
/**
|
||||
* The results for the corresponding request permissions. The value 0 indicates that a
|
||||
* permission is granted, and the value -1 indicates not.
|
||||
*
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @StageModelOnly
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
*/
|
||||
authResults: Array<number>;
|
||||
}
|
Loading…
Reference in New Issue
Block a user