提交 e5f4b037 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 3e766c2e
......@@ -64,7 +64,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0 or the permissionName exceeds 256 bytes. |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
**Example**
......@@ -74,7 +74,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
try {
atManager.checkAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS").then((data) => {
atManager.checkAccessToken(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS').then((data) => {
console.log(`checkAccessToken success, data->${JSON.stringify(data)}`);
}).catch((err) => {
console.log(`checkAccessToken fail, err->${JSON.stringify(err)}`);
......@@ -111,14 +111,14 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0 or the permissionName exceeds 256 bytes. |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
**Example**
```js
let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
let data = atManager.verifyAccessTokenSync(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
let data = atManager.verifyAccessTokenSync(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS');
console.log(`data->${JSON.stringify(data)}`);
```
......@@ -154,7 +154,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | The specified tokenID does not exist. |
| 12100003 | The specified permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
......@@ -169,7 +169,7 @@ let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
let permissionFlags = 1;
try {
atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags).then(() => {
atManager.grantUserGrantedPermission(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS', permissionFlags).then(() => {
console.log('grantUserGrantedPermission success');
}).catch((err) => {
console.log(`grantUserGrantedPermission fail, err->${JSON.stringify(err)}`);
......@@ -221,7 +221,7 @@ let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
let permissionFlags = 1;
try {
atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags, (err, data) => {
atManager.grantUserGrantedPermission(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS', permissionFlags, (err, data) => {
if (err) {
console.log(`grantUserGrantedPermission fail, err->${JSON.stringify(err)}`);
} else {
......@@ -280,7 +280,7 @@ let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
let permissionFlags = 1;
try {
atManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags).then(() => {
atManager.revokeUserGrantedPermission(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS', permissionFlags).then(() => {
console.log('revokeUserGrantedPermission success');
}).catch((err) => {
console.log(`revokeUserGrantedPermission fail, err->${JSON.stringify(err)}`);
......@@ -332,7 +332,7 @@ let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
let permissionFlags = 1;
try {
atManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags, (err, data) => {
atManager.revokeUserGrantedPermission(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS', permissionFlags, (err, data) => {
if (err) {
console.log(`revokeUserGrantedPermission fail, err->${JSON.stringify(err)}`);
} else {
......@@ -375,7 +375,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0 or the permissionName exceeds 256 bytes. |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
| 12100002 | The specified tokenID does not exist. |
| 12100003 | The specified permission does not exist. |
| 12100006 | The operation is not allowed. Either the application is a sandbox or the tokenID is from a remote device. |
......@@ -389,7 +389,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
try {
atManager.getPermissionFlags(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS").then((data) => {
atManager.getPermissionFlags(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS').then((data) => {
console.log(`getPermissionFlags success, data->${JSON.stringify(data)}`);
}).catch((err) => {
console.log(`getPermissionFlags fail, err->${JSON.stringify(err)}`);
......@@ -443,7 +443,7 @@ Subscribes to permission state changes of the specified applications and permiss
| ------------------ | --------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type to subscribe to. The value is **'permissionStateChange'**, which indicates the permission grant state change. |
| tokenIDList | Array&lt;number&gt; | Yes | Token IDs of the applications to observe. If this parameter is left empty, the permission grant state changes of all applications are observed. |
| permissionList | Array&lt;Permissions&gt; | Yes | Permissions to observe. If this parameter is left empty, the grant state changes of all permissions are observed. |
| permissionList | Array&lt;Permissions&gt; | Yes | List of permission names. If this parameter is left empty, the grant state changes of all permissions are subscribed to. |
| callback | Callback&lt;[PermissionStateChangeInfo](#permissionstatechangeinfo9)&gt; | Yes| Callback invoked to return the permission grant state change.|
**Error codes**
......@@ -452,7 +452,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0 or the permissionName exceeds 256 bytes. |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
| 12100004 | The interface is called repeatedly with the same input. |
| 12100005 | The registration time has exceeded the limitation. |
| 12100007 | Service is abnormal. |
......@@ -461,16 +461,16 @@ For details about the error codes, see [Application Access Control Error Codes](
**Example**
```js
import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl';
import {Permissions} from '@ohos.abilityAccessCtrl';
import bundleManager from '@ohos.bundle.bundleManager';
let atManager = abilityAccessCtrl.createAtManager();
let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
let permissionList: Array<Permissions> = ['ohos.permission.DISTRIBUTED_DATASYNC'];
try {
atManager.on('permissionStateChange', tokenIDList, permissionList, (data) => {
console.debug("receive permission state change, data:" + JSON.stringify(data));
console.debug('receive permission state change, data:' + JSON.stringify(data));
});
} catch(err) {
console.log(`catch err->${JSON.stringify(err)}`);
......@@ -505,20 +505,20 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenIDs or permissionNames in the list are all invalid. |
| 12100004 | The interface is not used together with "on". |
| 12100004 | The interface is not used together with 'on'. |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
**Example**
```js
import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl';
import {Permissions} from '@ohos.abilityAccessCtrl';
import bundleManager from '@ohos.bundle.bundleManager';
let atManager = abilityAccessCtrl.createAtManager();
let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
let permissionList: Array<Permissions> = ['ohos.permission.DISTRIBUTED_DATASYNC'];
try {
atManager.off('permissionStateChange', tokenIDList, permissionList);
} catch(err) {
......@@ -558,7 +558,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
let promise = atManager.verifyAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
let promise = atManager.verifyAccessToken(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS');
promise.then(data => {
console.log(`promise: data->${JSON.stringify(data)}`);
});
......@@ -599,10 +599,10 @@ For details about the error codes, see [Application Access Control Error Codes](
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
try {
atManager.requestPermissionsFromUser(this.context, ["ohos.permission.CAMERA"], (err, data)=>{
console.info("data:" + JSON.stringify(data));
console.info("data permissions:" + data.permissions);
console.info("data authResults:" + data.authResults);
atManager.requestPermissionsFromUser(this.context, ['ohos.permission.CAMERA'], (err, data)=>{
console.info('data:' + JSON.stringify(data));
console.info('data permissions:' + data.permissions);
console.info('data authResults:' + data.authResults);
});
} catch(err) {
console.log(`catch err->${JSON.stringify(err)}`);
......@@ -650,12 +650,12 @@ For details about the error codes, see [Application Access Control Error Codes](
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
try {
atManager.requestPermissionsFromUser(this.context, ["ohos.permission.CAMERA"]).then((data) => {
console.info("data:" + JSON.stringify(data));
console.info("data permissions:" + data.permissions);
console.info("data authResults:" + data.authResults);
atManager.requestPermissionsFromUser(this.context, ['ohos.permission.CAMERA']).then((data) => {
console.info('data:' + JSON.stringify(data));
console.info('data permissions:' + data.permissions);
console.info('data authResults:' + data.authResults);
}).catch((err) => {
console.info("data:" + JSON.stringify(err));
console.info('data:' + JSON.stringify(err));
})
} catch(err) {
console.log(`catch err->${JSON.stringify(err)}`);
......@@ -694,7 +694,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
let promise = atManager.verifyAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
let promise = atManager.verifyAccessToken(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS');
promise.then(data => {
console.log(`promise: data->${JSON.stringify(data)}`);
});
......@@ -727,14 +727,14 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0 or the permissionName exceeds 256 bytes. |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
**Example**
```js
let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
let data = atManager.checkAccessTokenSync(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
let data = atManager.checkAccessTokenSync(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS');
console.log(`data->${JSON.stringify(data)}`);
```
......
......@@ -62,12 +62,14 @@ Obtains distributed account information. This API uses an asynchronous callback
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
try {
accountAbility.getOsAccountDistributedInfo((err, data) => {
console.log("getOsAccountDistributedInfo err: " + JSON.stringify(err));
console.log('Query account info name: ' + data.name);
console.log('Query account info id: ' + data.id);
if (err) {
console.log('getOsAccountDistributedInfo exception: ' + JSON.stringify(err));
} else {
console.log('distributed information: ' + JSON.stringify(data));
}
});
} catch (e) {
console.log("getOsAccountDistributedInfo exception: " + JSON.stringify(e));
} catch (err) {
console.log('getOsAccountDistributedInfo exception: ' + JSON.stringify(err));
}
```
......@@ -98,15 +100,96 @@ Obtains distributed account information. This API uses a promise to return the r
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
try {
accountAbility.getOsAccountDistributedInfo().then((data) => {
console.log('Query account info name: ' + data.name);
console.log('Query account info id: ' + data.id);
console.log('distributed information: ' + JSON.stringify(data));
}).catch((err) => {
console.log("getOsAccountDistributedInfo err: " + JSON.stringify(err));
console.log('getOsAccountDistributedInfo exception: ' + JSON.stringify(err));
});
} catch (e) {
console.log("getOsAccountDistributedInfo exception: " + JSON.stringify(e));
} catch (err) {
console.log('getOsAccountDistributedInfo exception: ' + JSON.stringify(err));
}
```
### getOsAccountDistributedInfoByLocalId<sup>10+</sup>
getOsAccountDistributedInfoByLocalId(localId: number, callback: AsyncCallback&lt;DistributedInfo&gt;): void
Obtains distributed information about an OS account. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.OsAccount
**Required permissions**: ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| localId | number | Yes| ID of the target OS account.|
| callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the distributed account information obtained. Otherwise, **err** is an error object.|
**Error codes**
| ID| Error Message|
| -------- | ------------------- |
| 12300001 | System service exception. |
| 12300003 | Account not found. |
**Example**
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
try {
accountAbility.getOsAccountDistributedInfoByLocalId(100, (err, data) => {
if (err) {
console.log('getOsAccountDistributedInfoByLocalId exception: ' + JSON.stringify(err));
} else {
console.log('distributed information: ' + JSON.stringify(data));
}
});
} catch (err) {
console.log('getOsAccountDistributedInfoByLocalId exception: ' + JSON.stringify(err));
}
```
### getOsAccountDistributedInfoByLocalId<sup>10+</sup>
getOsAccountDistributedInfoByLocalId(localId: number): Promise&lt;DistributedInfo&gt;
Obtains distributed information about an OS account. This API uses a promise to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.OsAccount
**Required permissions**: ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;[DistributedInfo](#distributedinfo)&gt; | Promise used to return the distributed account information obtained.|
**Error codes**
| ID| Error Message|
| -------- | ------------------- |
| 12300001 | System service exception. |
| 12300003 | Account not found. |
**Example**
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
try {
accountAbility.getOsAccountDistributedInfoByLocalId(100).then((data) => {
console.log('distributed information: ' + JSON.stringify(data));
}).catch((err) => {
console.log('getOsAccountDistributedInfoByLocalId exception: ' + JSON.stringify(err));
});
} catch (err) {
console.log('getOsAccountDistributedInfoByLocalId exception: ' + JSON.stringify(err));
}
```
### queryOsAccountDistributedInfo<sup>(deprecated)</sup>
queryOsAccountDistributedInfo(callback: AsyncCallback&lt;DistributedInfo&gt;): void
......@@ -130,9 +213,11 @@ Obtains distributed account information. This API uses an asynchronous callback
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo((err, data) => {
console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err));
console.log('Query account info name: ' + data.name);
console.log('Query account info id: ' + data.id);
if (err) {
console.log('queryOsAccountDistributedInfo exception: ' + JSON.stringify(err));
} else {
console.log('distributed information: ' + JSON.stringify(data));
}
});
```
......@@ -160,10 +245,9 @@ Obtains distributed account information. This API uses a promise to return the r
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo().then((data) => {
console.log('Query account info name: ' + data.name);
console.log('Query account info id: ' + data.id);
console.log('distributed information: ' + JSON.stringify(data));
}).catch((err) => {
console.log("queryOsAccountDistributedInfoerr: " + JSON.stringify(err));
console.log('queryOsAccountDistributedInfo exception: ' + JSON.stringify(err));
});
```
......@@ -198,10 +282,14 @@ Sets the distributed account information. This API uses an asynchronous callback
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
try {
accountAbility.setOsAccountDistributedInfo(accountInfo, (err) => {
console.log("setOsAccountDistributedInfo err: " + JSON.stringify(err));
if (err) {
console.log('setOsAccountDistributedInfo exception: ' + JSON.stringify(err));
} else {
console.log('setOsAccountDistributedInfo successfully');
}
});
} catch (e) {
console.log("setOsAccountDistributedInfo exception: " + JSON.stringify(e));
} catch (err) {
console.log('setOsAccountDistributedInfo exception: ' + JSON.stringify(err));
}
```
......@@ -241,14 +329,109 @@ Sets the distributed account information. This API uses a promise to return the
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
try {
accountAbility.setOsAccountDistributedInfo(accountInfo).then(() => {
console.log('setOsAccountDistributedInfo Success');
console.log('setOsAccountDistributedInfo successfully');
}).catch((err) => {
console.log("setOsAccountDistributedInfo err: " + JSON.stringify(err));
console.log('setOsAccountDistributedInfo exception: ' + JSON.stringify(err));
});
} catch (e) {
console.log("setOsAccountDistributedInfo exception: " + JSON.stringify(e));
} catch (err) {
console.log('setOsAccountDistributedInfo exception: ' + JSON.stringify(err));
}
```
### setOsAccountDistributedInfoByLocalId<sup>10+</sup>
setOsAccountDistributedInfoByLocalId(localId: number, distributedInfo: DistributedInfo, callback: AsyncCallback&lt;void&gt;): void
Sets the distributed information for an OS account. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.OsAccount
**Required permissions**: ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| localId | number | Yes| ID of the target OS account.|
| accountInfo | [DistributedInfo](#distributedinfo) | Yes| Distributed account information to set.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result. If the distributed information is set successfully, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
| ID| Error Message|
| -------- | ------------------- |
| 12300001 | System service exception. |
| 12300002 | Invalid distributedInfo. |
| 12300003 | Account identified by localId or by distributedInfo not found. |
| 12300008 | Restricted OS account. |
**Example**
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
try {
accountAbility.setOsAccountDistributedInfoByLocalId(100, accountInfo, (err) => {
if (err) {
console.log('setOsAccountDistributedInfoByLocalId exception: ' + JSON.stringify(err));
} else {
console.log('setOsAccountDistributedInfoByLocalId successfully');
}
});
} catch (err) {
console.log('setOsAccountDistributedInfoByLocalId exception: ' + JSON.stringify(err));
}
```
### setOsAccountDistributedInfoByLocalId<sup>10+</sup>
setOsAccountDistributedInfoByLocalId(localId: number, distributedInfo: DistributedInfo): Promise&lt;void&gt;
Sets the distributed information for an OS account. This API uses a promise to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Account.OsAccount
**Required permissions**: ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| localId | number | Yes| ID of the target OS account.|
| distributedInfo | [DistributedInfo](#distributedinfo) | Yes| Distributed account information to set.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise that returns no value.|
**Error codes**
| ID| Error Message|
| -------- | ------------------- |
| 12300001 | System service exception. |
| 12300002 | Invalid distributedInfo. |
| 12300003 | Account identified by localId or by distributedInfo not found. |
| 12300008 | Restricted OS account. |
**Example**
```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
try {
accountAbility.setOsAccountDistributedInfoByLocalId(100, accountInfo).then(() => {
console.log('setOsAccountDistributedInfoByLocalId successfully');
}).catch((err) => {
console.log('setOsAccountDistributedInfoByLocalId exception: ' + JSON.stringify(err));
});
} catch (err) {
console.log('setOsAccountDistributedInfoByLocalId exception: ' + JSON.stringify(err));
}
```
### updateOsAccountDistributedInfo<sup>(deprecated)</sup>
updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback&lt;void&gt;): void
......@@ -275,7 +458,11 @@ Updates the distributed account information. This API uses an asynchronous callb
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo, (err) => {
console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err));
if (err) {
console.log('queryOsAccountDistributedInfo exception: ' + JSON.stringify(err));
} else {
console.log('queryOsAccountDistributedInfo successfully');
}
});
```
......@@ -308,22 +495,34 @@ Updates the distributed account information. This API uses a promise to return t
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo).then(() => {
console.log('updateOsAccountDistributedInfo Success');
console.log('updateOsAccountDistributedInfo successfully');
}).catch((err) => {
console.log("updateOsAccountDistributedInfo err: " + JSON.stringify(err));
console.log('updateOsAccountDistributedInfo exception: ' + JSON.stringify(err));
});
```
## DistributedInfo
Defines distributed OS account information.
Defines the distributed information about an OS account.
**System capability**: SystemCapability.Account.OsAccount
| Name| Type| Read-only| Mandatory| Description|
| -------- | -------- | -------- |-------- | -------- |
| name | string | No|Yes| Name of the distributed account. It must be a non-null string.|
| id | string | No|Yes| UID of the distributed account. It must be a non-null string.|
| event | string | No|Yes| Login state of the distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:<br>-&nbsp;Ohos.account.event.LOGIN<br>-&nbsp;Ohos.account.event.LOGOUT<br>-&nbsp;Ohos.account.event.TOKEN_INVALID<br>-&nbsp;Ohos.account.event.LOGOFF |
| nickname<sup>9+</sup> | string | No|No| Nickname of the distributed account. By default, no value is passed.|
| avatar<sup>9+</sup> | string | No|No| Avatar of the distributed account. By default, no value is passed.|
| status<sup>10+</sup> | [DistributedAccountStatus](#distributedaccountstatus10) | Yes|No| Status of the distributed account. The value is of the enumerated type. The default status is unlogged.|
| scalableData<sup>8+</sup> | object | No|No| Extended information about the distributed account, passed in key-value (KV) pairs based on service requirements. By default, no value is passed.|
## DistributedAccountStatus<sup>10+</sup>
Enumerates the statuses of a distributed account.
**System capability**: SystemCapability.Account.OsAccount
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the distributed account. It must be a non-null string.|
| id | string | Yes| UID of the distributed account. It must be a non-null string.|
| event | string | Yes| Login state of the distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:<br>-&nbsp;Ohos.account.event.LOGIN<br>-&nbsp;Ohos.account.event.LOGOUT<br>-&nbsp;Ohos.account.event.TOKEN_INVALID<br>-&nbsp;Ohos.account.event.LOGOFF |
| nickname<sup>9+</sup> | string | No| Nickname of the distributed account. It must be a non-null string.|
| avatar<sup>9+</sup> | string | No| Avatar of the distributed account. It must be a non-null string.|
| scalableData<sup>8+</sup> | object | No| Extended information about the distributed account, passed in key-value (KV) pairs.<br>**NOTE**<br>This parameter is reserved and not used in the setters and getters.|
| Name | Value| Description |
| ---- | ------ | ----------- |
| NOT_LOGGED_IN | 0 | The account has not logged in.|
| LOGGED_IN | 1 | The account has logged in.|
......@@ -2433,7 +2433,7 @@ Unsubscribes from the OS account activation states, including the states of the
| -------- | -------------------------- | ---- | ------------------------------------------------------------ |
| type | 'activate' \| 'activating' | Yes | Type of the event to unsubscribe from. The value **activate** means an event indicating that an OS account is activated, and **activating** means an event indicating that an OS account is being activated.|
| name | string | Yes | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes, and must be the same as the value passed by **on()**.|
| callback | Callback&lt;number&gt; | No | Callback to unregister. By default, **0** is returned. |
| callback | Callback&lt;number&gt; | No | Callback for the OS account activation state events. By default, no value is passed, which unsubscribes from all the callbacks for the OS account activation state events. |
**Error codes**
......@@ -5649,7 +5649,7 @@ Obtains authentication information of the specified type. This API uses a promis
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------- | ---- | -------- |
| authType | [AuthType](#authtype8) | No | Authentication credential type.|
| authType | [AuthType](#authtype8) | No | Authentication type. By default, no value is passed, which means to obtain information about all authentication types.|
**Return value**
......@@ -5929,12 +5929,14 @@ Defines the executor property.
**System capability**: SystemCapability.Account.OsAccount
| Name | Type | Mandatory | Description |
| ------------ | ---------------------------------------- | ----- | ----------------- |
| result | number | Yes | Result. |
| authSubType | [AuthSubType](#authsubtype8) | Yes | Authentication credential subtype.|
| remainTimes | number | No | Number of remaining authentication times. |
| freezingTime | number | No | Freezing time. |
| Name | Type | Readable| Writable| Description |
| ------------ | ---------------------------- | ----- | -----|----------------- |
| result | number | Yes | Yes | Result. |
| authSubType | [AuthSubType](#authsubtype8) | Yes | Yes | Authentication credential subtype.|
| remainTimes | number | Yes | Yes | Number of remaining authentication times. |
| freezingTime | number | Yes | Yes | Freezing time. |
| enrollmentProgress<sup>10+</sup> | string | Yes | Yes | Enrollment progress. By default, no value is passed.|
| sensorInfo<sup>10+</sup> | string | Yes | Yes | Sensor information. By default, no value is passed.|
## AuthResult<sup>8+</sup>
......@@ -5946,9 +5948,9 @@ Defines the authentication result information.
| Name | Type | Mandatory | Description |
| ------------ | ----------- | ----- | ----------------- |
| token | Uint8Array | No | Authentication token. |
| remainTimes | number | No | Number of remaining authentication times. |
| freezingTime | number | No | Freezing time. |
| token | Uint8Array | No | Authentication token. By default, no value is passed. |
| remainTimes | number | No | Number of remaining authentication times. By default, no value is passed. |
| freezingTime | number | No | Freezing time. By default, no value is passed. |
## CredentialInfo<sup>8+</sup>
......@@ -5974,7 +5976,7 @@ Defines the request result information.
| Name | Type | Mandatory | Description |
| ------------ | ----------- | ----- | ----------------- |
| credentialId | Uint8Array | No | Credential ID. |
| credentialId | Uint8Array | No | Credential ID. By default, no value is passed. |
## EnrolledCredInfo<sup>8+</sup>
......@@ -6004,6 +6006,8 @@ Enumerates the types of properties to obtain.
| AUTH_SUB_TYPE | 1 | Authentication credential subtype.|
| REMAIN_TIMES | 2 | Remaining time. |
| FREEZING_TIME | 3 | Freezing time. |
| ENROLLMENT_PROGRESS<sup>10+</sup> | 4 | Enrollment progress. |
| SENSOR_INFO<sup>10+</sup> | 5 | Sensor information. |
## SetPropertyType<sup>8+</sup>
......@@ -6047,6 +6051,9 @@ Enumerates the authentication credential subtypes.
| PIN_MIXED | 10002 | Custom mixed credentials.|
| FACE_2D | 20000 | 2D face credential. |
| FACE_3D | 20001 | 3D face credential. |
| FINGERPRINT_CAPACITIVE<sup>10+</sup> | 30000 | Capacitive fingerprint. |
| FINGERPRINT_OPTICAL<sup>10+</sup> | 30001 | Optical fingerprint. |
| FINGERPRINT_ULTRASONIC<sup>10+</sup> | 30002 | Ultrasonic fingerprint. |
| DOMAIN_MIXED<sup>9+</sup> | 10240001 | Mixed domain authentication credentials. |
## AuthTrustLevel<sup>8+</sup>
......@@ -6136,6 +6143,8 @@ Enumerates the tip codes for fingerprint authentication.
| FINGERPRINT_TIP_PARTIAL | 3 | Only part of the fingerprint image is detected. |
| FINGERPRINT_TIP_TOO_FAST | 4 | The fingerprint image is incomplete due to quick motion. |
| FINGERPRINT_TIP_TOO_SLOW | 5 | Failed to read the fingerprint image due to lack of motion. |
| FINGERPRINT_TIP_FINGER_DOWN<sup>10+</sup> | 6 | Press your finger. |
| FINGERPRINT_TIP_FINGER_UP<sup>10+</sup> | 7 | Lift your finger. |
## OsAccountInfo
......@@ -6148,16 +6157,16 @@ Defines the OS account information.
| localId | number | Yes | ID of the target OS account. |
| localName | string | Yes | OS account name. |
| type | [OsAccountType](#osaccounttype) | Yes | OS account type. |
| constraints | Array&lt;string&gt; | No | [Constraints](#constraints) on the OS account.|
| constraints | Array&lt;string&gt; | No | OS account [Constraints](#constraints). By default, no value is passed.|
| isVerified<sup>8+</sup> | boolean | Yes | Whether to verify the OS account. |
| photo<sup>8+</sup> | string | No | Profile photo of the OS account. |
| photo<sup>8+</sup> | string | No | OS account avatar. By default, no value is passed. |
| createTime<sup>8+</sup> | number | Yes | Time when the OS account was created. |
| lastLoginTime<sup>8+</sup> | number | No | Last login time of the OS account. |
| lastLoginTime<sup>8+</sup> | number | No | Last login time of the OS account. By default, no value is passed. |
| serialNumber<sup>8+</sup> | number | Yes | SN of the OS account. |
| isActived<sup>8+</sup> | boolean | Yes | Whether the OS account is activated. |
| isCreateCompleted<sup>8+</sup> | boolean | Yes | Whether the OS account information is complete. |
| distributedInfo | [distributedAccount.DistributedInfo](js-apis-distributed-account.md) | No | Distributed account information. |
| domainInfo<sup>8+</sup> | [DomainAccountInfo](#domainaccountinfo8) | No | Domain account information. |
| distributedInfo | [distributedAccount.DistributedInfo](js-apis-distributed-account.md) | No | Distributed account information. By default, no value is passed. |
| domainInfo<sup>8+</sup> | [DomainAccountInfo](#domainaccountinfo8) | No | Domain account information. By default, no value is passed. |
## DomainAccountInfo<sup>8+</sup>
......@@ -6169,7 +6178,7 @@ Defines the domain account information.
| ----------- | ------ | ---- | ---------- |
| domain | string | Yes | Domain name. |
| accountName | string | Yes | Domain account name.|
| accountId<sup>10+</sup> | string | No | Domain account ID.<br>**System API**: This is a system API.|
| accountId<sup>10+</sup> | string | No | Domain account ID.<br>**System API**: It is a system API and is left blank by default.|
## Constraints
......
......@@ -59,7 +59,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // You can use getApplicationInfo to obtain the access token ID.
try {
privacyManager.addPermissionUsedRecord(tokenID, "ohos.permission.PERMISSION_USED_STATS", 1, 0).then(() => {
privacyManager.addPermissionUsedRecord(tokenID, 'ohos.permission.PERMISSION_USED_STATS', 1, 0).then(() => {
console.log('addPermissionUsedRecord success');
}).catch((err) => {
console.log(`addPermissionUsedRecord fail, err->${JSON.stringify(err)}`);
......@@ -88,7 +88,7 @@ The permission usage record includes the application identity (token ID) of the
| permissionName | Permissions | Yes | Name of the permission.|
| successCount | number | Yes | Number of successful accesses.|
| failCount | number | Yes | Number of failed accesses.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If a usage record is added successfully, **err** is **undefine**. Otherwise, **err** is an error object.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If a usage record is added successfully, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -109,7 +109,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // You can use getApplicationInfo to obtain the access token ID.
try {
privacyManager.addPermissionUsedRecord(tokenID, "ohos.permission.PERMISSION_USED_STATS", 1, 0, (err, data) => {
privacyManager.addPermissionUsedRecord(tokenID, 'ohos.permission.PERMISSION_USED_STATS', 1, 0, (err, data) => {
if (err) {
console.log(`addPermissionUsedRecord fail, err->${JSON.stringify(err)}`);
} else {
......@@ -161,14 +161,14 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
import privacyManager from '@ohos.privacyManager';
let request = {
"tokenId": 1,
"isRemote": false,
"deviceId": "device",
"bundleName": "bundle",
"permissionNames": [],
"beginTime": 0,
"endTime": 1,
"flag":privacyManager.PermissionUsageFlag.FLAG_PERMISSION_USAGE_DETAIL,
'tokenId': 1,
'isRemote': false,
'deviceId': 'device',
'bundleName': 'bundle',
'permissionNames': [],
'beginTime': 0,
'endTime': 1,
'flag':privacyManager.PermissionUsageFlag.FLAG_PERMISSION_USAGE_DETAIL,
};
try {
privacyManager.getPermissionUsedRecord(request).then((data) => {
......@@ -196,7 +196,7 @@ Obtains historical permission usage records. This API uses an asynchronous callb
| Name | Type | Mandatory| Description |
| -------- | ------------------- | ---- | ------------------------------------------ |
| request | [PermissionUsedRequest](#permissionusedrequest) | Yes| Request for querying permission usage records.|
| callback | AsyncCallback<[PermissionUsedResponse](#permissionusedresponse)> | Yes| Callback invoked to return the result. If the query is successful, **err** is **undefine** and **data** is the permission usage record. Otherwise, **err** is an error object.|
| callback | AsyncCallback<[PermissionUsedResponse](#permissionusedresponse)> | Yes| Callback invoked to return the result. If the query is successful, **err** is **undefined** and **data** is the permission usage record. Otherwise, **err** is an error object.|
**Error codes**
......@@ -216,14 +216,14 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
import privacyManager from '@ohos.privacyManager';
let request = {
"tokenId": 1,
"isRemote": false,
"deviceId": "device",
"bundleName": "bundle",
"permissionNames": [],
"beginTime": 0,
"endTime": 1,
"flag":privacyManager.PermissionUsageFlag.FLAG_PERMISSION_USAGE_DETAIL,
'tokenId': 1,
'isRemote': false,
'deviceId': 'device',
'bundleName': 'bundle',
'permissionNames': [],
'beginTime': 0,
'endTime': 1,
'flag':privacyManager.PermissionUsageFlag.FLAG_PERMISSION_USAGE_DETAIL,
};
try {
privacyManager.getPermissionUsedRecord(request, (err, data) => {
......@@ -281,7 +281,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // You can use getApplicationInfo to obtain the access token ID.
try {
privacyManager.startUsingPermission(tokenID, "ohos.permission.PERMISSION_USED_STATS").then(() => {
privacyManager.startUsingPermission(tokenID, 'ohos.permission.PERMISSION_USED_STATS').then(() => {
console.log('startUsingPermission success');
}).catch((err) => {
console.log(`startUsingPermission fail, err->${JSON.stringify(err)}`);
......@@ -307,7 +307,7 @@ Starts to use a permission and flushes the permission usage record. This API is
| -------------- | --------------------- | ---- | ------------------------------------ |
| tokenID | number | Yes | Application token ID of the invoker. The value can be obtained from [ApplicationInfo](js-apis-bundle-ApplicationInfo.md).|
| permissionName | Permissions | Yes | Permission to use. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the permission is successfully used, **err** is **undefine**. Otherwise, **err** is an error object.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the permission is successfully used, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -329,7 +329,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // You can use getApplicationInfo to obtain the access token ID.
try {
privacyManager.startUsingPermission(tokenID, "ohos.permission.PERMISSION_USED_STATS", (err, data) => {
privacyManager.startUsingPermission(tokenID, 'ohos.permission.PERMISSION_USED_STATS', (err, data) => {
if (err) {
console.log(`startUsingPermission fail, err->${JSON.stringify(err)}`);
} else {
......@@ -384,7 +384,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // You can use getApplicationInfo to obtain the access token ID.
try {
privacyManager.stopUsingPermission(tokenID, "ohos.permission.PERMISSION_USED_STATS").then(() => {
privacyManager.stopUsingPermission(tokenID, 'ohos.permission.PERMISSION_USED_STATS').then(() => {
console.log('stopUsingPermission success');
}).catch((err) => {
console.log(`stopUsingPermission fail, err->${JSON.stringify(err)}`);
......@@ -410,7 +410,7 @@ Stops using a permission. This API is called by a system application and uses a
| -------------- | --------------------- | ---- | ------------------------------------ |
| tokenID | number | Yes | Application token ID of the invoker. The value can be obtained from [ApplicationInfo](js-apis-bundle-ApplicationInfo.md).|
| permissionName | Permissions | Yes | Permission to use. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefine**. Otherwise, **err** is an error object.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -432,7 +432,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // You can use getApplicationInfo to obtain the access token ID.
try {
privacyManager.stopUsingPermission(tokenID, "ohos.permission.PERMISSION_USED_STATS", (err, data) => {
privacyManager.stopUsingPermission(tokenID, 'ohos.permission.PERMISSION_USED_STATS', (err, data) => {
if (err) {
console.log(`stopUsingPermission fail, err->${JSON.stringify(err)}`);
} else {
......@@ -482,7 +482,7 @@ import privacyManager from '@ohos.privacyManager';
let permissionList = [];
try {
privacyManager.on('activeStateChange', permissionList, (data) => {
console.debug("receive permission state change, data:" + JSON.stringify(data));
console.debug('receive permission state change, data:' + JSON.stringify(data));
});
} catch(err) {
console.log(`catch err->${JSON.stringify(err)}`);
......@@ -514,7 +514,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| -------- | -------- |
| 12100001 | The permissionNames in the list are all invalid, or the list size exceeds 1024 bytes. |
| 12100004 | The interface is not used together with "on()".|
| 12100004 | The interface is not used together with 'on'.|
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
......@@ -550,14 +550,14 @@ Represents the request for querying permission usage records.
| Name | Type | Mandatory | Description |
| -------- | -------------- | ---- | ---------------------------------------- |
| tokenId | number | No | Token ID of the application (invoker). |
| isRemote | boolean | No | Whether the token ID belongs to the application on a remote device. The default value is **false**.|
| deviceId | string | No | ID of the device hosting the target application. |
| bundleName | string | No | Bundle name of the target application.|
| permissionNames | Array&lt;Permissions&gt; | No | Permissions to query. |
| beginTime | number | No | Start time of the query, in ms. The default value is **0**, indicating that no start time is set.|
| endTime | number | No | End time of the query, in ms. The default value is **0**, indicating that no end time is set.|
| flag | [PermissionUsageFlag](#permissionusageflag) | Yes | Query mode. The default value is **FLAG_PERMISSION_USAGE_SUMMARY**.|
| tokenId | number | No | Token ID of the application (invoker).<br>By default, all applications are queried. |
| isRemote | boolean | No | Whether to query the permission usage records of the remote device.<br> The default value is **false**, which means the permission usage records of the local device are queried by default.|
| deviceId | string | No | ID of the device hosting the target application.<br> The default value is the local device ID. |
| bundleName | string | No | Bundle name of the target application.<br>By default, all applications are queried.|
| permissionNames | Array&lt;Permissions&gt; | No | Permissions to query.<br>By default, the usage records of all permissions are queried. |
| beginTime | number | No | Start time of the query, in ms.<br>The default value is **0**, which means the start time is not set.|
| endTime | number | No | End time of the query, in ms.<br>The default value is **0**, which means the end time is not set.|
| flag | [PermissionUsageFlag](#permissionusageflag) | Yes | Query mode.|
## PermissionUsedResponse
......@@ -567,9 +567,9 @@ Represents the permission usage records of all applications.
| Name | Type | Mandatory | Description |
| -------- | -------------- | ---- | ---------------------------------------- |
| beginTime | number | No | Start time of the query, in ms.|
| endTime | number | No | End time of the query, in ms.|
| bundleRecords | Array&lt;[BundleUsedRecord](#bundleusedrecord)&gt; | No | Permission usage records. |
| beginTime | number | Yes | Start time of the query, in ms.|
| endTime | number | Yes | End time of the query, in ms.|
| bundleRecords | Array&lt;[BundleUsedRecord](#bundleusedrecord)&gt; | Yes | Permission usage records. |
## BundleUsedRecord
......@@ -579,11 +579,11 @@ Represents the permission access records of an application.
| Name | Type | Mandatory | Description |
| -------- | -------------- | ---- | ---------------------------------------- |
| tokenId | number | No | Token ID of the application (invoker). |
| isRemote | boolean | No | Whether the token ID belongs to the application on a remote device. The default value is **false**.|
| deviceId | string | No | ID of the device hosting the target application. |
| bundleName | string | No | Bundle name of the target application.|
| permissionRecords | Array&lt;[PermissionUsedRecord](#permissionusedrecord)&gt; | No | Permission usage records of the target application. |
| tokenId | number | Yes | Token ID of the application (invoker). |
| isRemote | boolean | Yes | Whether the token ID belongs to the application on a remote device. The default value is **false**.|
| deviceId | string | Yes | ID of the device hosting the target application. |
| bundleName | string | Yes | Bundle name of the target application.|
| permissionRecords | Array&lt;[PermissionUsedRecord](#permissionusedrecord)&gt; | Yes | Permission usage records of the target application. |
## PermissionUsedRecord
......@@ -593,14 +593,14 @@ Represents the usage records of a permission.
| Name | Type | Mandatory | Description |
| -------- | -------------- | ---- | ---------------------------------------- |
| permissionName | Permissions | No | Name of the permission. |
| accessCount | number | No | Total number of times that the permission is accessed.|
| rejectCount | number | No | Total number of times that the access to the permission is rejected.|
| lastAccessTime | number | No | Last time when the permission was accessed, accurate to ms.|
| lastRejectTime | number | No | Last time when the access to the permission was rejected, accurate to ms.|
| lastAccessDuration | number | No | Last access duration, in ms.|
| accessRecords | Array&lt;[UsedRecordDetail](#usedrecorddetail)&gt; | No | Successful access records. This parameter is valid only when **flag** is **FLAG_PERMISSION_USAGE_SUMMARY**. By default, 10 records are provided. |
| rejectRecords | Array&lt;[UsedRecordDetail](#usedrecorddetail)&gt; | No | Rejected access records. This parameter is valid only when **flag** is **FLAG_PERMISSION_USAGE_SUMMARY**. By default, 10 records are provided. |
| permissionName | Permissions | Yes | Name of the permission. |
| accessCount | number | Yes | Total number of times that the permission is accessed.|
| rejectCount | number | Yes | Total number of times that the access to the permission is rejected.|
| lastAccessTime | number | Yes | Last time when the permission was accessed, accurate to ms.|
| lastRejectTime | number | Yes | Last time when the access to the permission was rejected, accurate to ms.|
| lastAccessDuration | number | Yes | Last access duration, in ms.|
| accessRecords | Array&lt;[UsedRecordDetail](#usedrecorddetail)&gt; | Yes | Successful access records. This parameter is valid only when **flag** is **FLAG_PERMISSION_USAGE_SUMMARY**. By default, 10 records are provided. |
| rejectRecords | Array&lt;[UsedRecordDetail](#usedrecorddetail)&gt; | Yes | Rejected access records. This parameter is valid only when **flag** is **FLAG_PERMISSION_USAGE_SUMMARY**. By default, 10 records are provided. |
## UsedRecordDetail
......@@ -610,9 +610,9 @@ Represents the details of a single access record.
| Name | Type | Mandatory | Description |
| -------- | -------------- | ---- | ---------------------------------------- |
| status | number | No | Access status. |
| timestamp | number | No | Access timestamp, in ms.|
| accessDuration | number | No | Access duration, in ms. |
| status | number | Yes | Access status. |
| timestamp | number | Yes | Access timestamp, in ms.|
| accessDuration | number | Yes | Access duration, in ms. |
## PermissionActiveStatus
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册