# @ohos.enterprise.restrictions (Restrictions)
This **restrictions** module provides APIs for disallowing general features of devices.
> **NOTE**
>
> The initial APIs of this module are supported since API version 12. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs of this module can be used only in the stage model.
>
> The APIs of this module can be called only by a [device administrator application](../../mdm/mdm-kit-guide.md#introduction) that is enabled.
## Modules to Import
```ts
import { restrictions } from '@kit.MDMKit';
```
## restrictions.setDisallowedPolicy
setDisallowedPolicy(admin: Want, feature: string, disallow: boolean): void
Disallows a feature.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application. |
| feature | string | Yes | Feature to set.
- **bluetooth**: Bluetooth capability of the device.
- **modifyDateTime**: capability of setting the system time of the device.
- **printer**: printer capability of the device.
- **hdc**: OpenHarmony Device Connector (hdc).
- **microphone**: microphone capability of the device.
- **fingerprint**: fingerprint authentication capability of the device.
- **usb**: USB capability of the device.
- **wifi**: Wi-Fi capability of the device. |
| disallow | boolean | Yes | Whether to disallow the feature. The value **true** means to disallow the feature; the value **false** means the opposite. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
| ID| Error Message |
| -------- | ------------------------------------------------------------ |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device. |
| 201 | Permission verification failed. The application does not have the permission required to call the API. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```ts
import { Want } from '@kit.AbilityKit';
let wantTemp: Want = {
bundleName: 'bundleName',
abilityName: 'abilityName',
};
try {
restrictions.setDisallowedPolicy(wantTemp, 'printer', true);
console.info('Succeeded in setting printer disabled');
} catch (err) {
console.error(`Failed to set printer disabled. Code is ${err.code}, message is ${err.message}`);
}
```
## restrictions.getDisallowedPolicy
getDisallowedPolicy(admin: Want, feature: string): boolean
Obtains the status of a feature.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application. |
| feature | string | Yes | Name of the feature, whose status is to be obtained.
- **bluetooth**: Bluetooth capability of the device.
- **modifyDateTime**: capability of setting the system time of the device.
- **printer**: printer capability of the device.
- **hdc**: OpenHarmony Device Connector (hdc).
- **microphone**: microphone capability of the device.
- **fingerprint**: fingerprint authentication capability of the device.
- **usb**: USB capability of the device.
- **wifi**: Wi-Fi capability of the device. |
**Return value**
| Type | Description |
| ------- | ------------------------------------------------------------ |
| boolean | Returns **true** if the feature is disallowed; returns **false** otherwise.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
| ID| Error Message |
| -------- | ------------------------------------------------------------ |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device. |
| 201 | Permission verification failed. The application does not have the permission required to call the API. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```ts
import { Want } from '@kit.AbilityKit';
let wantTemp: Want = {
bundleName: 'bundleName',
abilityName: 'abilityName',
};
try {
let result: boolean = restrictions.getDisallowedPolicy(wantTemp, 'printer');
console.info(`Succeeded in querying is the printing function disabled : ${result}`);
} catch (err) {
console.error(`Failed to set printer disabled. Code is ${err.code}, message is ${err.message}`);
}
```