1# PermissionRequestResult 2 3The **PermissionRequestResult** module defines the result of a permission request. The result is returned when [requestPermissionsFromUser](js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9) is called to request permissions. 4 5> **NOTE** 6> 7> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8> - The APIs of this module can be used only in the stage model. 9 10## Attributes 11 12**System capability**: SystemCapability.Security.AccessToken 13 14| Name| Type| Read Only| Optional| Description| 15| -------- | -------- | -------- | -------- | -------- | 16| permissions | Array<string> | Yes| No| Permissions requested.<br> **Atomic service API**: This API can be used in atomic services since API version 11.| 17| authResults | Array<number> | Yes| No| Result of the permission request.<br>- **-1**: The permission is not authorized and must be set in **Settings** without displaying a dialog box.<br>- **0**: The permission is authorized.<br>- **2**: The permission is not authorized due to an invalid request. The possible causes are as follows:<br> - The permission is not declared in the configuration file.<br> - The permission name is invalid.<br> - Certain conditions are not met when the permission is applied. For details, see [ohos.permission.LOCATION](../../security/AccessToken/permissions-for-all.md#ohospermissionlocation) and [ohos.permission.APPROXIMATELY_LOCATION](../../security/AccessToken/permissions-for-all.md#ohospermissionapproximately_location).<br> **Atomic service API**: This API can be used in atomic services since API version 11.| 18| dialogShownResults<sup>12+</sup> | Array<boolean> | Yes| Yes| Whether to display a dialog box.<br>The value **true** means to display a dialog box;<br>the value **false** means the opposite.<br> **Atomic service API**: This API can be used in atomic services since API version 12.| 19 20## Usage 21 22The permission request result is obtained through an **atManager** instance. 23 24**Example** 25For details about how to obtain the context in the example, see [Obtaining the Context of UIAbility](../../application-models/uiability-usage.md#obtaining-the-context-of-uiability). 26 27```ts 28import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; 29import { BusinessError } from '@ohos.base'; 30import common from '@ohos.app.ability.common'; 31 32let atManager = abilityAccessCtrl.createAtManager(); 33try { 34 let context: Context = getContext(this) as common.UIAbilityContext; 35 atManager.requestPermissionsFromUser(context, ["ohos.permission.CAMERA"]).then((data) => { 36 console.info("data:" + JSON.stringify(data)); 37 console.info("data permissions:" + data.permissions); 38 console.info("data authResults:" + data.authResults); 39 console.info("data dialogShownResults:" + data.dialogShownResults); 40 }).catch((err: BusinessError) => { 41 console.error("data:" + JSON.stringify(err)); 42 }) 43} catch(err) { 44 console.error(`catch err->${JSON.stringify(err)}`); 45} 46``` 47