1# @ohos.enterprise.restrictions (Restrictions) (System API)
2
3This **restrictions** module provides APIs for setting general restriction policies, including disabling or enabling the printer and OpenHarmony Device Connector (hdc) for devices.
4
5> **NOTE**
6>
7> 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.
8>
9> The APIs of this module can be used only in the stage model.
10>
11> The APIs of this module can be called only by a [device administrator application](../../mdm/mdm-kit-guide.md#introduction) that is [enabled](js-apis-enterprise-adminManager-sys.md#adminmanagerenableadmin).
12>
13> This topic describes only the system APIs provided by the module. For details about its public APIs, see [@ohos.enterprise.restrictions](js-apis-enterprise-restrictions.md).
14
15## Modules to Import
16
17```ts
18import { restrictions } from '@kit.MDMKit';
19```
20
21## restrictions.setPrinterDisabled
22
23setPrinterDisabled(admin: Want, disabled: boolean, callback: AsyncCallback\<void>): void
24
25Enables or disables the printer through the specified device administrator application. This API uses an asynchronous callback to return the result.
26
27**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
28
29**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
30
31**Parameters**
32
33| Name  | Type                                 | Mandatory  | Description     |
34| ----- | ----------------------------------- | ---- | ------- |
35| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
36| disabled  | boolean | Yes| Operation to perform. The value **true** means to disable the printer; the value **false** means the opposite. |
37| callback | AsyncCallback\<void> | Yes| Callback used to return the result.<br>If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
38
39**Error codes**
40
41For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
42
43| ID| Error Message                                                                     |
44| ------- | ---------------------------------------------------------------------------- |
45| 9200001 | The application is not an administrator application of the device.           |
46| 9200002 | The administrator application does not have permission to manage the device. |
47| 201 | Permission verification failed. The application does not have the permission required to call the API. |
48| 202 | Permission verification failed. A non-system application calls a system API. |
49| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
50
51**Example**
52
53```ts
54import { Want } from '@kit.AbilityKit';
55let wantTemp: Want = {
56  bundleName: 'bundleName',
57  abilityName: 'abilityName',
58};
59
60restrictions.setPrinterDisabled(wantTemp, true, (err) => {
61  if (err) {
62    console.error(`Failed to set printer disabled. Code is ${err.code}, message is ${err.message}`);
63    return;
64  }
65  console.info('Succeeded in setting printer disabled');
66})
67```
68
69## restrictions.setPrinterDisabled
70
71setPrinterDisabled(admin: Want, disabled: boolean): Promise\<void>
72
73Enables or disables the printer through the specified device administrator application. This API uses a promise to return the result.
74
75**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
76
77**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
78
79**Parameters**
80
81| Name  | Type                                 | Mandatory  | Description     |
82| ----- | ----------------------------------- | ---- | ------- |
83| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
84| disabled  | boolean | Yes| Operation to perform. The value **true** means to disable the printer; the value **false** means the opposite. |
85
86**Return value**
87
88| Type  | Description                                 |
89| ----- | ----------------------------------- |
90| Promise\<void> | Promise that returns no value. If the operation fails, an error object will be thrown. |
91
92**Error codes**
93
94For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
95
96| ID| Error Message                                                                     |
97| ------- | ---------------------------------------------------------------------------- |
98| 9200001 | The application is not an administrator application of the device.            |
99| 9200002 | The administrator application does not have permission to manage the device. |
100| 201 | Permission verification failed. The application does not have the permission required to call the API. |
101| 202 | Permission verification failed. A non-system application calls a system API. |
102| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
103
104**Example**
105
106```ts
107import { Want } from '@kit.AbilityKit';
108import { BusinessError } from '@kit.BasicServicesKit';
109let wantTemp: Want = {
110  bundleName: 'bundleName',
111  abilityName: 'abilityName',
112};
113
114restrictions.setPrinterDisabled(wantTemp, true).then(() => {
115  console.info('Succeeded in setting printer disabled');
116}).catch((err: BusinessError) => {
117  console.error(`Failed to set printer disabled. Code is ${err.code}, message is ${err.message}`);
118})
119```
120
121## restrictions.isPrinterDisabled
122
123isPrinterDisabled(admin: Want, callback: AsyncCallback\<boolean>): void
124
125Checks whether the printer is disabled for devices through the specified device administrator application. This API uses an asynchronous callback to return the result.
126
127**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
128
129**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
130
131**Parameters**
132
133| Name  | Type                                 | Mandatory  | Description     |
134| ----- | ----------------------------------- | ---- | ------- |
135| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
136| callback | AsyncCallback\<boolean> | Yes| Callback used to return the result. The value **true** means that the printer is disabled; the value **false** means the opposite. |
137
138**Error codes**
139
140For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
141
142| ID| Error Message                                                                     |
143| ------- | ---------------------------------------------------------------------------- |
144| 9200001 | The application is not an administrator application of the device.           |
145| 9200002 | The administrator application does not have permission to manage the device. |
146| 201 | Permission verification failed. The application does not have the permission required to call the API. |
147| 202 | Permission verification failed. A non-system application calls a system API. |
148| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
149
150**Example**
151
152```ts
153import { Want } from '@kit.AbilityKit';
154let wantTemp: Want = {
155  bundleName: 'bundleName',
156  abilityName: 'abilityName',
157};
158
159restrictions.isPrinterDisabled(wantTemp, (err, result) => {
160  if (err) {
161    console.error(`Failed to query is the printing function disabled or not. Code is ${err.code}, message is ${err.message}`);
162    return;
163  }
164  console.info(`Succeeded in querying is the printing function disabled : ${result}`);
165})
166```
167
168## restrictions.isPrinterDisabled
169
170isPrinterDisabled(admin: Want): Promise\<boolean>
171
172Checks whether the printer is disabled for devices through the specified device administrator application. This API uses a promise to return the result.
173
174**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
175
176**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
177
178**Parameters**
179
180| Name  | Type                                 | Mandatory  | Description     |
181| ----- | ----------------------------------- | ---- | ------- |
182| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
183
184**Return value**
185
186| Type  | Description                                 |
187| ----- | ----------------------------------- |
188| Promise\<boolean> | Promise used to return the result. The value **true** means that the printer is disabled; the value **false** means the opposite. |
189
190**Error codes**
191
192For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
193
194| ID| Error Message                                                                     |
195| ------- | ---------------------------------------------------------------------------- |
196| 9200001 | The application is not an administrator application of the device.            |
197| 9200002 | The administrator application does not have permission to manage the device. |
198| 201 | Permission verification failed. The application does not have the permission required to call the API. |
199| 202 | Permission verification failed. A non-system application calls a system API. |
200| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
201
202**Example**
203
204```ts
205import { Want } from '@kit.AbilityKit';
206import { BusinessError } from '@kit.BasicServicesKit';
207let wantTemp: Want = {
208  bundleName: 'bundleName',
209  abilityName: 'abilityName',
210};
211
212restrictions.isPrinterDisabled(wantTemp).then((result) => {
213  console.info(`Succeeded in querying is the printing function disabled : ${result}`);
214}).catch((err: BusinessError) => {
215  console.error(`Failed to query is the printing function disabled or not. Code is ${err.code}, message is ${err.message}`);
216})
217```
218
219## restrictions.setHdcDisabled
220
221setHdcDisabled(admin: Want, disabled: boolean, callback: AsyncCallback\<void>): void
222
223Enables or disables hdc through the specified device administrator application. This API uses an asynchronous callback to return the result.
224
225**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
226
227**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
228
229**Parameters**
230
231| Name  | Type                                 | Mandatory  | Description     |
232| ----- | ----------------------------------- | ---- | ------- |
233| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
234| disabled  | boolean | Yes| Operation to perform. The value **true** means to disable hdc; the value **false** means the opposite.|
235| callback | AsyncCallback\<void> | Yes| Callback used to return the result.<br>If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
236
237**Error codes**
238
239For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
240
241| ID| Error Message                                                                     |
242| ------- | ---------------------------------------------------------------------------- |
243| 9200001 | The application is not an administrator application of the device.           |
244| 9200002 | The administrator application does not have permission to manage the device. |
245| 201 | Permission verification failed. The application does not have the permission required to call the API. |
246| 202 | Permission verification failed. A non-system application calls a system API. |
247| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
248
249**Example**
250
251```ts
252import { Want } from '@kit.AbilityKit';
253let wantTemp: Want = {
254  bundleName: 'bundleName',
255  abilityName: 'abilityName',
256};
257
258restrictions.setHdcDisabled(wantTemp, true, (err) => {
259  if (err) {
260    console.error(`Failed to set hdc disabled. Code is ${err.code}, message is ${err.message}`);
261    return;
262  }
263  console.info('Succeeded in setting hdc disabled');
264})
265```
266
267## restrictions.setHdcDisabled
268
269setHdcDisabled(admin: Want, disabled: boolean): Promise\<void>
270
271Enables or disables hdc through the specified device administrator application. This API uses a promise to return the result.
272
273**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
274
275**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
276
277**Parameters**
278
279| Name  | Type                                 | Mandatory  | Description     |
280| ----- | ----------------------------------- | ---- | ------- |
281| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
282| disabled  | boolean | Yes| Operation to perform. The value **true** means to disable hdc; the value **false** means the opposite.|
283
284**Return value**
285
286| Type  | Description                                 |
287| ----- | ----------------------------------- |
288| Promise\<void> | Promise that returns no value. If the operation fails, an error object will be thrown. |
289
290**Error codes**
291
292For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
293
294| ID| Error Message                                                                     |
295| ------- | ---------------------------------------------------------------------------- |
296| 9200001 | The application is not an administrator application of the device.            |
297| 9200002 | The administrator application does not have permission to manage the device. |
298| 201 | Permission verification failed. The application does not have the permission required to call the API. |
299| 202 | Permission verification failed. A non-system application calls a system API. |
300| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
301
302**Example**
303
304```ts
305import { Want } from '@kit.AbilityKit';
306import { BusinessError } from '@kit.BasicServicesKit';
307let wantTemp: Want = {
308  bundleName: 'bundleName',
309  abilityName: 'abilityName',
310};
311
312restrictions.setHdcDisabled(wantTemp, true).then(() => {
313  console.info('Succeeded in setting hdc disabled');
314}).catch((err: BusinessError) => {
315  console.error(`Failed to set hdc disabled. Code is ${err.code}, message is ${err.message}`);
316})
317```
318
319## restrictions.isHdcDisabled
320
321isHdcDisabled(admin: Want, callback: AsyncCallback\<boolean>): void
322
323Checks whether hdc is disabled through the specified device administrator application. This API uses an asynchronous callback to return the result.
324
325**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
326
327**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
328
329**Parameters**
330
331| Name  | Type                                 | Mandatory  | Description     |
332| ----- | ----------------------------------- | ---- | ------- |
333| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
334| callback | AsyncCallback\<boolean> | Yes| Callback used to return the result. The value **true** means hdc is disabled; the value **false** means the opposite.|
335
336**Error codes**
337
338For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
339
340| ID| Error Message                                                                     |
341| ------- | ---------------------------------------------------------------------------- |
342| 9200001 | The application is not an administrator application of the device.           |
343| 9200002 | The administrator application does not have permission to manage the device. |
344| 201 | Permission verification failed. The application does not have the permission required to call the API. |
345| 202 | Permission verification failed. A non-system application calls a system API. |
346| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
347
348**Example**
349
350```ts
351import { Want } from '@kit.AbilityKit';
352let wantTemp: Want = {
353  bundleName: 'bundleName',
354  abilityName: 'abilityName',
355};
356
357restrictions.isHdcDisabled(wantTemp, (err, result) => {
358  if (err) {
359    console.error(`Failed to query is hdc disabled or not. Code is ${err.code}, message is ${err.message}`);
360    return;
361  }
362  console.info(`Succeeded in querying is hdc disabled : ${result}`);
363})
364```
365
366## restrictions.isHdcDisabled
367
368isHdcDisabled(admin: Want): Promise\<boolean>
369
370Checks whether hdc is disabled through the specified device administrator application. This API uses a promise to return the result.
371
372**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
373
374**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
375
376**Parameters**
377
378| Name  | Type                                 | Mandatory  | Description     |
379| ----- | ----------------------------------- | ---- | ------- |
380| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
381
382**Return value**
383
384| Type  | Description                                 |
385| ----- | ----------------------------------- |
386| Promise\<boolean> | Promise used to return the result. The value **true** means hdc is disabled; the value **false** means the opposite.|
387
388**Error codes**
389
390For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
391
392| ID| Error Message                                                                     |
393| ------- | ---------------------------------------------------------------------------- |
394| 9200001 | The application is not an administrator application of the device.            |
395| 9200002 | The administrator application does not have permission to manage the device. |
396| 201 | Permission verification failed. The application does not have the permission required to call the API. |
397| 202 | Permission verification failed. A non-system application calls a system API. |
398| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
399
400**Example**
401
402```ts
403import { Want } from '@kit.AbilityKit';
404import { BusinessError } from '@kit.BasicServicesKit';
405let wantTemp: Want = {
406  bundleName: 'bundleName',
407  abilityName: 'abilityName',
408};
409
410restrictions.isHdcDisabled(wantTemp).then((result) => {
411  console.info(`Succeeded in querying is hdc disabled : ${result}`);
412}).catch((err: BusinessError) => {
413  console.error(`Failed to query is hdc disabled or not. Code is ${err.code}, message is ${err.message}`);
414})
415```
416
417## restrictions.isMicrophoneDisabled<sup>11+</sup>
418
419isMicrophoneDisabled(admin: Want): boolean
420
421Checks whether the microphone is disabled through the specified device administrator application.
422
423**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
424
425**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
426
427**Parameters**
428
429| Name  | Type                                 | Mandatory  | Description     |
430| ----- | ----------------------------------- | ---- | ------- |
431| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
432
433**Return value**
434
435| Type  | Description                                 |
436| ----- | ----------------------------------- |
437| boolean | Returns **true** if the microphone is disabled; returns **false** otherwise.|
438
439**Error codes**
440
441For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
442
443| ID| Error Message                                                                     |
444| ------- | ---------------------------------------------------------------------------- |
445| 9200001 | The application is not an administrator application of the device.           |
446| 9200002 | The administrator application does not have permission to manage the device. |
447| 201 | Permission verification failed. The application does not have the permission required to call the API. |
448| 202 | Permission verification failed. A non-system application calls a system API. |
449| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
450
451**Example**
452
453```ts
454import { Want } from '@kit.AbilityKit';
455let wantTemp: Want = {
456  bundleName: 'com.example.myapplication',
457  abilityName: 'EntryAbility',
458};
459
460try {
461  let result = restrictions.isMicrophoneDisabled(wantTemp);
462  console.info(`Succeeded in querying is microphone disabled : ${result}`);
463} catch (err) {
464  console.error(`Failed to query is microphone disabled or not. Code is ${err.code}, message is ${err.message}`);
465}
466```
467
468## restrictions.disableMicrophone<sup>11+</sup>
469
470disableMicrophone(admin: Want, disable: boolean): void
471
472Disables or enables the device microphone through the specified device administrator application.
473
474**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
475
476**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
477
478**Parameters**
479
480| Name  | Type                                 | Mandatory  | Description     |
481| ----- | ----------------------------------- | ---- | ------- |
482| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
483| disable  | boolean | Yes| Operation to perform. The value **true** means to disable the microphone; the value **false** means the opposite.|
484
485**Error codes**
486
487For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
488
489| ID| Error Message                                                                     |
490| ------- | ---------------------------------------------------------------------------- |
491| 9200001 | The application is not an administrator application of the device.            |
492| 9200002 | The administrator application does not have permission to manage the device. |
493| 201 | Permission verification failed. The application does not have the permission required to call the API. |
494| 202 | Permission verification failed. A non-system application calls a system API. |
495| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
496
497**Example**
498
499```ts
500import { Want } from '@kit.AbilityKit';
501import { BusinessError } from '@kit.BasicServicesKit';
502let wantTemp: Want = {
503  bundleName: 'com.example.myapplication',
504  abilityName: 'EntryAbility',
505};
506
507try {
508  restrictions.disableMicrophone(wantTemp, true);
509  console.info('Succeeded in setting microphone disabled');
510} catch (err) {
511  console.error(`Failed to disable microphone. Code is ${err.code}, message is ${err.message}`);
512}
513```
514
515## restrictions.setFingerprintAuthDisabled<sup>11+</sup>
516
517setFingerprintAuthDisabled(admin: Want, disabled: boolean): void
518
519Disables or enables fingerprint authentication through the specified device administrator application. This API returns the result synchronously.
520
521**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
522
523**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
524
525**Parameters**
526
527| Name  | Type                                 | Mandatory  | Description     |
528| ----- | ----------------------------------- | ---- | ------- |
529| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
530| disabled  | boolean | Yes| Operation to perform. The value **true** means to disable fingerprint authentication; the value **false** the opposite.|
531
532**Error codes**
533
534For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
535
536| ID| Error Message                                                                     |
537| ------- | ---------------------------------------------------------------------------- |
538| 9200001 | The application is not an administrator application of the device.            |
539| 9200002 | The administrator application does not have permission to manage the device. |
540| 201 | Permission verification failed. The application does not have the permission required to call the API. |
541| 202 | Permission verification failed. A non-system application calls a system API. |
542| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
543
544**Example**
545
546```ts
547import { Want } from '@kit.AbilityKit';
548
549let wantTemp: Want = {
550  bundleName: 'bundleName',
551  abilityName: 'abilityName',
552};
553
554try {
555  restrictions.setFingerprintAuthDisabled(wantTemp, true);
556  console.info('Succeeded in disabling the fingerprint auth');
557} catch (err) {
558  console.error(`Failed to disable fingerprint auth. Code: ${err.code}, message: ${err.message}`);
559};
560
561```
562
563## restrictions.isFingerprintAuthDisabled<sup>11+</sup>
564
565isFingerprintAuthDisabled(admin: Want): boolean
566
567Checks whether fingerprint authentication is disabled through the specified device administrator application. This API returns the result synchronously.
568
569**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS
570
571**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
572
573**Parameters**
574
575| Name  | Type                                 | Mandatory  | Description     |
576| ----- | ----------------------------------- | ---- | ------- |
577| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
578
579**Return value**
580
581| Type  | Description                                 |
582| ----- | ----------------------------------- |
583| boolean | Returns **true** if fingerprint authentication is disabled; returns **false** otherwise.|
584
585**Error codes**
586
587For details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
588
589| ID| Error Message                                                                     |
590| ------- | ---------------------------------------------------------------------------- |
591| 9200001 | The application is not an administrator application of the device.            |
592| 9200002 | The administrator application does not have permission to manage the device. |
593| 201 | Permission verification failed. The application does not have the permission required to call the API. |
594| 202 | Permission verification failed. A non-system application calls a system API. |
595| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
596
597**Example**
598
599```ts
600import { Want } from '@kit.AbilityKit';
601
602let wantTemp: Want = {
603  bundleName: 'bundleName',
604  abilityName: 'abilityName',
605};
606
607try {
608  let result: boolean = restrictions.isFingerprintAuthDisabled(wantTemp);
609  console.info(`Succeeded in getting the state of fingerprint auth. result : ${result}`);
610} catch (err) {
611  console.error(`Failed to get the state of fingerprint auth. Code: ${err.code}, message: ${err.message}`);
612};
613```
614