未验证 提交 f75c77b0 编写于 作者: O openharmony_ci 提交者: Gitee

!22820 [翻译完成】#I7TG17

Merge pull request !22820 from Annie_wang/PR21987
......@@ -943,6 +943,102 @@ adminManager.unsubscribeManagedEvent(wantTemp, events).then(() => {
})
```
## adminManager.authorizeAdmin<sup>10+</sup>
authorizeAdmin(admin: Want, bundleName: string, callback: AsyncCallback&lt;void&gt;): void
Authorizes the administrator rights to an application through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| bundleName | string | Yes| Bundle name of the application to be authorized with the administrator rights.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ----------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
| 9200009 | authorize permission to the application failed. |
**Example**
```js
let wantTemp = {
bundleName: 'bundleName',
abilityName: 'abilityName',
};
let bundleName: string = "com.example.application";
adminManager.authorizeAdmin(wantTemp, bundleName, (err) => {
if (err) {
console.error(`Failed to authorize permission to the application. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Successfully authorized permission to the application');
});
```
## adminManager.authorizeAdmin<sup>10+</sup>
authorizeAdmin(admin: Want, bundleName: string): Promise&lt;void&gt;
Authorizes the administrator rights to an application through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| bundleName | string | Yes| Bundle name of the application to be authorized with the administrator rights.|
**Return value**
| Type | Description |
| ----- | ----------------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. If the operation fails, an error object will be thrown.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ----------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
| 9200009 | authorize permission to the application failed. |
**Example**
```js
let wantTemp = {
bundleName: 'bundleName',
abilityName: 'abilityName',
};
let bundleName: string = "com.example.application";
adminManager.authorizeAdmin(wantTemp, bundleName).then(() => {
}).catch((err) => {
console.error(`Failed to authorize permission to the application. Code: ${err.code}, message: ${err.message}`);
})
```
## EnterpriseInfo
Represents the enterprise information of a device administrator application.
......
......@@ -4,25 +4,25 @@
>
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
## 9200001 Application Not a Device Administrator
## 9200001 DeviceAdmin Not Enabled
**Error Message**
The application is not a administrator of the device.
The application is not an administrator of the device.
**Description**
This error code is reported when the calling application is not an administrator of the device.
This error code is reported when the caller is not an enabled device administrator application.
**Possible Causes**
The calling application has not been enabled as an administrator of the device.
The enterprise device management APIs can be called only by a device administrator application that has been enabled.
**Solution**
Make sure the application is enabled as an administrator of the device.
Check that the caller is an enabled device administrator application.
## 9200002 Insufficient Permission for Systsm Administration
## 9200002 Permission Denied
**Error Message**
......@@ -30,15 +30,15 @@ The administrator application does not have permission to manage the device.
**Description**
This error code is reported when the API requires a permission level higher than that granted to the calling application.
This error code is reported when the device administrator application does not have the permission to call the API.
**Possible Causes**
The application is a device administrator application, and the called API is restricted to a device super administrator application.
The device administrator application cannot call the APIs that are accessible only by a super device administrator application.
**Solution**
Make sure the enabled device administrator type is the same as that required by the called API.
Check that the device administrator type enabled for the caller is the same as that required by the API.
## 9200003 Invalid Administrator Ability Component
......@@ -48,18 +48,17 @@ The administrator ability component is invalid.
**Description**
This error code is reported when the administrator ability component specified in the input parameters is invalid.
This error code is reported when the specified device administrator ability component is invalid.
**Possible Causes**
The specified administrator ability component is invalid due to any of the following:
1. The administrator ability component does not exist when the application is enabled as a device administrator application.
2. The administrator ability component is not valid in an enterprise setting.
1. The administrator ability component does not exist when the device administrator application is enabled.
2. The administrator ability component is not a valid enterprise administrator ability component.
**Solution**
1. Make sure the name of the device administrator ability component is included in the application bundle when the application is enabled as a device administrator application.
2. Make sure the administrator ability component inherits the **EnterpriseAdminExtensionAbility** component defined by the enterprise device administrator framework.
1. Check that the name of the administrator ability component is included in the application bundle when the application is enabled as a device administrator application.
2. Check that the administrator ability component inherits the **EnterpriseAdminExtensionAbility** component defined by the enterprise device management framework.
## 9200004 Failed to Enable the Device Administrator Application
......@@ -69,20 +68,19 @@ Failed to activate the administrator application of the device.
**Description**
This error code is reported when the application fails to be enabled as a device administrator application.
This error code is reported when an application fails to be enabled as a device administrator application.
**Possible Causes**
1. Multiple applications are enabled as super device administrators (SDAs).
2. The application has been enabled as a device administrator, and the device administrator type has changed.
3. Multiple device administrator ability components of the same application are enabled.
1. Multiple applications are enabled as the super device administrator application.
2. The application has been enabled as a device administrator application with a different administrator type.
3. Multiple device administrator ability components are enabled for the same application.
**Solution**
1. Make sure only one application is enabled as SDA.
2. Check whether the application has been enabled as a device administrator and whether the device administrator type changes when it is enabled again. If this is the case, disable the device administrator and enable it again.
3. Check whether any ability component in the application has been enabled as the device administrator. Only one ability component in an application can be enabled as the device administrator.
1. Check that only one super device administrator application exists.
2. Check whether the current application has been enabled as a device administrator with a different device administrator type. If yes, disable the device administrator application and try again.
3. Check whether a device administrator ability component has been enabled for the application. Only one device administrator ability component can be enabled for an application.
## 9200005 Failed to Disable the Device Administrator Application
......@@ -92,19 +90,18 @@ Failed to deactivate the administrator application of the device.
**Description**
This error code is reported when the application to disable has not been enabled as a device administrator application or the attempt to disable the device administrator application is made by a device administrator application.
This error code is reported when the operation for disabling a device administrator application fails.
**Possible Causes**
1. The application to disable has not been enabled as a device administrator application.
2. The attempt to disable the device administrator application is made by a device administrator application.
1. The application to be disabled is not an enabled device administrator application.
2. The caller cannot disable other device administrator applications.
**Solution**
1. Check whether the target application has been enabled as a device administrator application.
2. Check whether the specified ability component in the target application has been enabled as a device administrator.
3. Check whether the attempt to disable the device administrator application is made by a device administrator application.
1. Check that the target device administrator application has been enabled.
2. Check that the specified device administrator ability component of the target device administrator application has been enabled.
3. Check that the device administrator application to be disabled is the caller itself.
## 9200006 Invalid User ID
......@@ -114,20 +111,19 @@ The specified user ID is invalid.
**Description**
This error code is reported when the application calls an API to set the user policy but the specified user ID does not exist or the specified user ID is different from the caller user ID.
This error code is reported when the specified user ID does not exist or the specified user ID is different from the caller's user ID.
**Possible Causes**
1. The user ID used to set a user policy does not exist.
2. The specified user ID is different from the caller user ID, and the application is not a super device administrator (SDA) application.
1. The user ID specified for setting a user policy does not exist.
2. The specified user ID is different from the caller's user ID when the application is not a super device administrator application.
**Solution**
1. Make sure the user ID specified in the called API is valid.
2. Check whether the caller user ID and the specified user ID are the same. In non-SDA mode, policies cannot be set across users.
1. Check that the specified user ID is valid.
2. Check that caller's user ID is the same as the specified user ID. If the application is not a super device administrator application, policies cannot be set across users.
## 9200007 System Service Error
## 9200007 System Ability Error
**Error Message**
......@@ -135,21 +131,20 @@ The system ability work abnormally.
**Description**
This error code is reported when the enterprise device management service is not working correctly.
This error code is reported when the enterprise device management ability is not working properly.
**Possible Causes**
1. The enterprise device management service is not started properly.
1. The EnterpriseAdminAbility is not started.
2. The RPC object for enterprise device management cannot be obtained.
3. Other services on which the enterprise device management service depends are not started properly or the RPC object cannot be obtained for them.
4. A system exception occurs during the running of the enterprise device management service.
3. Other abilities, on which the EnterpriseAdminAbility depends, are not started, or the RPC object cannot be obtained.
4. A system exception occurs during the running of EnterpriseAdminAbility.
**Solution**
Try again later or restart the device.
## 9200008 Invalid System Event Subscription
## 9200008 Invalid System Subscription Event
**Error Message**
......@@ -165,4 +160,45 @@ The enterprise device management module does not support subscription to the spe
**Solution**
Make sure the event to subscribe to is a valid management event supported by the enterprise device management module.
Check that the specified event is valid and supported by the enterprise device management module.
## 9200009 Failed to Grant Permissions to the Application
**Error Message**
Authorize permission to the application failed.
**Description**
This error code is reported when the super device administrator application fails to grant administrator rights to other applications.
**Possible Causes**
The target application is not installed by the administrator.
**Solution**
Check that the target application has been installed by the administrator.
## 9201002 Failed to Install the Application
**Error Message**
The application installation failed.
**Description**
This error code is reported when a device administrator application fails to install an enterprise application.
**Possible Causes**
1. The application installation path is empty or invalid, or does not exist.
2. The operation attempts to install multiple apps with different bundle names.
3. The application to be installed already exists when the installation parameter flag is 0.
4. The user ID is invalid.
**Solution**
1. Check that the application installation path is valid.
2. Check that all the installation parameters are valid.
3. Check that the same application is installed.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册