interface_sdk-js/api/@ohos.enterprise.restrictions.d.ts
openharmony_ci f40f62f725
!13507 [EDM]指纹策略
Merge pull request !13507 from 黄晓/master
2024-08-21 06:34:11 +00:00

364 lines
22 KiB
TypeScript

/*
* Copyright (c) 2023-2024 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.
*/
/**
* @file
* @kit MDMKit
*/
import type { AsyncCallback } from './@ohos.base';
import type Want from './@ohos.app.ability.Want';
/**
* This module provides the capability to manage restriction policy of the enterprise devices.
*
* @namespace restrictions
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @since 10
*/
declare namespace restrictions {
/**
* Disable or enable the printing function of the device
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_RESTRICT_POLICY
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* The admin must have the corresponding permission.
* @param { boolean } disabled - true if the user disables the printing function.
* @param { AsyncCallback<void> } callback - the callback of setPrinterDisabled.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @StageModelOnly
* @since 10
*/
function setPrinterDisabled(admin: Want, disabled: boolean, callback: AsyncCallback<void>): void;
/**
* Disable or enable the printing function of the device
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_RESTRICT_POLICY
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* The admin must have the corresponding permission.
* @param { boolean } disabled - true if the user disables the printing function.
* @returns { Promise<void> } the promise returned by the setPrinterDisabled.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @StageModelOnly
* @since 10
*/
function setPrinterDisabled(admin: Want, disabled: boolean): Promise<void>;
/**
* Is the printing function of the device disabled
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_RESTRICT_POLICY
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* If the admin is not empty, it must have the corresponding permission.
* @param { AsyncCallback<boolean> } callback - the callback of isPrinterDisabled.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @stagemodelonly
* @since 10
*/
function isPrinterDisabled(admin: Want, callback: AsyncCallback<boolean>): void;
/**
* Is the printing function of the device disabled
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_RESTRICT_POLICY
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* If the admin is not empty, it must have the corresponding permission.
* @returns { Promise<boolean> } the promise returned by the isPrinterDisabled.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @stagemodelonly
* @since 10
*/
function isPrinterDisabled(admin: Want): Promise<boolean>;
/**
* Disable or enable the HDC function of the device
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_RESTRICT_POLICY
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* The admin must have the corresponding permission.
* @param { boolean } disabled - true if the user disables the HDC function.
* @param { AsyncCallback<void> } callback - the callback of setHdcDisabled.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @StageModelOnly
* @since 10
*/
function setHdcDisabled(admin: Want, disabled: boolean, callback: AsyncCallback<void>): void;
/**
* Disable or enable the HDC function of the device
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_RESTRICT_POLICY
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* The admin must have the corresponding permission.
* @param { boolean } disabled - true if the user disables the HDC function.
* @returns { Promise<void> } the promise returned by the setHdcDisabled.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @StageModelOnly
* @since 10
*/
function setHdcDisabled(admin: Want, disabled: boolean): Promise<void>;
/**
* Is the HDC function of the device disabled
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_RESTRICT_POLICY
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* If the admin is not empty, it must have the corresponding permission.
* @param { AsyncCallback<boolean> } callback - the callback of isHdcDisabled.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @stagemodelonly
* @since 10
*/
function isHdcDisabled(admin: Want, callback: AsyncCallback<boolean>): void;
/**
* Is the HDC function of the device disabled
* This function can be called by a super administrator.
*
* @permission ohos.permission.ENTERPRISE_RESTRICT_POLICY
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* If the admin is not empty, it must have the corresponding permission.
* @returns { Promise<boolean> } the promise returned by the isHdcDisabled.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @stagemodelonly
* @since 10
*/
function isHdcDisabled(admin: Want): Promise<boolean>;
/**
* Disables the microphone of device.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* The admin must have the corresponding permission.
* @param { boolean } disable - true if disable the microphone of device, otherwise false.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @stagemodelonly
* @since 11
*/
function disableMicrophone(admin: Want, disable: boolean): void;
/**
* Queries whether the microphone of device is disabled.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* If the admin is not empty, it must have the corresponding permission.
* @returns { boolean } true if the microphone of device is disabled, otherwise false.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @stagemodelonly
* @since 11
*/
function isMicrophoneDisabled(admin: Want): boolean;
/**
* Sets the device fingerprint authorization capability disabled.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* The admin must have the corresponding permission.
* @param { boolean } disabled - true if set the fingerprint authorization capability disabled.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @stagemodelonly
* @since 11
*/
function setFingerprintAuthDisabled(admin: Want, disabled: boolean): void;
/**
* Queries device fingerprint authorization capability is disabled or enabled.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* If the admin is not empty, it must have the corresponding permission.
* @returns { boolean } true if the fingerprint authorization capability is disabled.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @systemapi
* @stagemodelonly
* @since 11
*/
function isFingerprintAuthDisabled(admin: Want): boolean;
/**
* Disallows the specific feature of the device.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* The admin must have the corresponding permission.
* @param { string } feature - feature indicates the specific feature to be disallowed or allowed,
* the supported device features include modifyDateTime, bluetooth, printer, hdc, microphone, fingerprint, usb and wifi.
* @param { boolean } disallow - true if disallow the specific feature of device, otherwise false.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
function setDisallowedPolicy(admin: Want, feature: string, disallow: boolean): void;
/**
* Queries whether the specific feature of the device is disallowed.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* If the admin is not empty, it must have the corresponding permission.
* @param { string } feature - feature indicates the specific feature to be queried,
* the supported device features include modifyDateTime, bluetooth, printer, hdc, microphone, fingerprint, usb and wifi.
* @returns { boolean } true if the specific feature of device is disallowed, otherwise false.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 12
*/
function getDisallowedPolicy(admin: Want, feature: string): boolean;
/**
* Disallows the specific feature of the device for the specified account.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* @param { string } feature - feature indicates the specific feature to be disallowed or allowed.
* @param { boolean } disallow - true if disallow the specific feature of device, otherwise false.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device.
* @throws { BusinessError } 9200010 - A conflict policy has been configured.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
function setDisallowedPolicyForAccount(admin: Want, feature: string, disallow: boolean, accountId: number): void;
/**
* Queries whether the specific feature of the device is disallowed for the specified account.
*
* @permission ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
* @param { Want } admin - admin indicates the enterprise admin extension ability information.
* @param { string } feature - feature indicates the specific feature to be queried.
* @param { number } accountId - accountId indicates the account ID to be queried.
* @returns { boolean } true if the specific feature of device is disallowed, otherwise false.
* @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
* @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
* @stagemodelonly
* @since 13
*/
function getDisallowedPolicyForAccount(admin: Want, feature: string, accountId: number): boolean;
}
export default restrictions;