diff --git a/api/@ohos.enterpriseDeviceManager.d.ts b/api/@ohos.enterpriseDeviceManager.d.ts index db9a78797696e8c1c9ec5c45aadc24de1f15225e..a61f712a2429d27981c0e4e96de1e7426c2d5548 100644 --- a/api/@ohos.enterpriseDeviceManager.d.ts +++ b/api/@ohos.enterpriseDeviceManager.d.ts @@ -15,6 +15,7 @@ import { AsyncCallback, Callback } from "./basic"; import { DeviceSettingsManager } from "./enterpriseDeviceManager/DeviceSettingsManager"; +import { DeviceNetworkManager } from "./enterpriseDeviceManager/DeviceNetworkManager"; import Want from "./@ohos.application.want"; /** @@ -151,6 +152,15 @@ declare namespace enterpriseDeviceManager { function getDeviceSettingsManager(callback: AsyncCallback): void; function getDeviceSettingsManager(): Promise; + /** + * Obtains the interface used to set device network policy. + * + * @since 10 + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @return Returns the DeviceNetworkManager interface. + */ + function getDeviceNetworkManager(callback: AsyncCallback): void; + function getDeviceNetworkManager(): Promise; } export default enterpriseDeviceManager; \ No newline at end of file diff --git a/api/enterpriseDeviceManager/DeviceNetworkManager.ts b/api/enterpriseDeviceManager/DeviceNetworkManager.ts new file mode 100644 index 0000000000000000000000000000000000000000..e513b26d822f6d3ee24420f83f79df8ed9626f1d --- /dev/null +++ b/api/enterpriseDeviceManager/DeviceNetworkManager.ts @@ -0,0 +1,66 @@ +/* + * 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, Callback } from "../basic"; +import Want from "../@ohos.application.want"; + +/** + * @name Offers set network policies on the devices. + * @since 10 + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + */ +export interface DeviceNetworkManager { + + /** + * Add the block list and trust list of the Broswer. + * + * @since 10 + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @param admin Indicates the administrator ability information. + * @param isTrustList True if the network address list to add is trust list. + * @return {@code true} if add the browser network trust list or block list successfully. + * @permission ohos.permission.EDM_MANAGE_NETWORK + */ + addBrowserNetworkList(admin: Want, isTrustList: boolean, addrList: Array, callback: AsyncCallback): void; + addBrowserNetworkList(admin: Want, isTrustList: boolean, addrList: Array, userId: number, callback: AsyncCallback): void; + addBrowserNetworkList(admin: Want, isTrustList: boolean, addrList: Array, userId?: number): Promise; + + /** + * Remove the block list and trust list of the Broswer. + * + * @since 10 + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @param admin Indicates the administrator ability information. + * @param isTrustList True if the network address list to remove is trust list. + * @return {@code true} if remove the browser network trust list or block list successfully. + * @permission ohos.permission.EDM_MANAGE_NETWORK + */ + removeBrowserNetworkList(admin: Want, isTrustList: boolean, addrList: Array, callback: AsyncCallback): void; + removeBrowserNetworkList(admin: Want, isTrustList: boolean, addrList: Array, userId: number, callback: AsyncCallback): void; + removeBrowserNetworkList(admin: Want, isTrustList: boolean, addrList: Array, userId?: number): Promise; + + /** + * Get the block list and trust list of the Broswer. + * + * @since 10 + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @param admin Indicates the administrator ability information. + * @param isTrustList True if the network address list to get is trust list. + * @return {@code true} if get the browser network trust list or block list successfully. + */ + getBrowserNetworkList(admin: Want, isTrustList: boolean, callback: AsyncCallback>): void; + getBrowserNetworkList(admin: Want, isTrustList: boolean, userId: number, callback: AsyncCallback>): void; + getBrowserNetworkList(admin: Want, isTrustList: boolean, userId?: number): Promise>; +} \ No newline at end of file