Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
ae5833a5
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ae5833a5
编写于
4月 24, 2023
作者:
Y
yaobaohua
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
disallow install hap
Signed-off-by:
N
yaobaohua
<
yaobaohua1@huawei.com
>
上级
1e139629
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
445 addition
and
27 deletion
+445
-27
zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md
...on-dev/reference/apis/js-apis-enterprise-bundleManager.md
+445
-27
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md
浏览文件 @
ae5833a5
...
...
@@ -26,7 +26,7 @@ addAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCal
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| 参数
名
| 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| appIds | Array
<
string
>
| 是 | 允许安装包的白名单。 |
...
...
@@ -38,8 +38,8 @@ addAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCal
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 920000
3 | the administrator ability component is invalid
. |
| 920000
7 | the system ability work abnormally
. |
| 920000
1 | the application is not an administrator of the device
. |
| 920000
2 | the administrator application does not have permission to manage the device
. |
**示例:**
...
...
@@ -71,7 +71,7 @@ addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, ca
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| 参数
名
| 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| appIds | Array
<
string
>
| 是 | 允许安装包的白名单。 |
...
...
@@ -84,8 +84,8 @@ addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, ca
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 920000
3 | the administrator ability component is invalid
. |
| 920000
7 | the system ability work abnormally
. |
| 920000
1 | the application is not an administrator of the device
. |
| 920000
2 | the administrator application does not have permission to manage the device
. |
**示例:**
...
...
@@ -117,7 +117,7 @@ addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number):
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| 参数
名
| 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| appIds | Array
<
string
>
| 是 | 允许安装包的白名单。 |
...
...
@@ -135,8 +135,8 @@ addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number):
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 920000
3 | the administrator ability component is invalid
. |
| 920000
7 | the system ability work abnormally
. |
| 920000
1 | the application is not an administrator of the device
. |
| 920000
2 | the administrator application does not have permission to manage the device
. |
**示例:**
...
...
@@ -168,7 +168,7 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: Async
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| 参数
名
| 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| appIds | Array
<
string
>
| 是 | 移除允许安装包的白名单。 |
...
...
@@ -180,8 +180,8 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: Async
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 920000
3 | the administrator ability component is invalid
. |
| 920000
7 | the system ability work abnormally
. |
| 920000
1 | the application is not an administrator of the device
. |
| 920000
2 | the administrator application does not have permission to manage the device
. |
**示例:**
...
...
@@ -213,7 +213,7 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number,
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| 参数
名
| 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| appIds | Array
<
string
>
| 是 | 允许安装包的白名单。 |
...
...
@@ -226,8 +226,8 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number,
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 920000
3 | the administrator ability component is invalid
. |
| 920000
7 | the system ability work abnormally
. |
| 920000
1 | the application is not an administrator of the device
. |
| 920000
2 | the administrator application does not have permission to manage the device
. |
**示例:**
...
...
@@ -259,7 +259,7 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| 参数
名
| 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| appIds | Array
\&
lt;string
>
| 是 | 允许安装包的白名单。 |
...
...
@@ -277,8 +277,8 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 920000
3 | the administrator ability component is invalid
. |
| 920000
7 | the system ability work abnormally
. |
| 920000
1 | the application is not an administrator of the device
. |
| 920000
2 | the administrator application does not have permission to manage the device
. |
**示例:**
...
...
@@ -310,7 +310,7 @@ getAllowedInstallBundles(admin: Want, callback: AsyncCallback<Array<string
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| 参数
名
| 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| callback | AsyncCallback
<
Array
<
string
>>
| 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 |
...
...
@@ -321,8 +321,8 @@ getAllowedInstallBundles(admin: Want, callback: AsyncCallback<Array<string
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 920000
3 | the administrator ability component is invalid
. |
| 920000
7 | the system ability work abnormally
. |
| 920000
1 | the application is not an administrator of the device
. |
| 920000
2 | the administrator application does not have permission to manage the device
. |
**示例:**
...
...
@@ -353,7 +353,7 @@ getAllowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback<
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| 参数
名
| 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
...
...
@@ -365,8 +365,8 @@ getAllowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback<
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 920000
3 | the administrator ability component is invalid
. |
| 920000
7 | the system ability work abnormally
. |
| 920000
1 | the application is not an administrator of the device
. |
| 920000
2 | the administrator application does not have permission to manage the device
. |
**示例:**
...
...
@@ -397,7 +397,7 @@ getAllowedInstallBundles(admin: Want, userId?: number): Promise<Array<stri
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| 参数
名
| 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
...
...
@@ -414,8 +414,8 @@ getAllowedInstallBundles(admin: Want, userId?: number): Promise<Array<stri
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 920000
3 | the administrator ability component is invalid
. |
| 920000
7 | the system ability work abnormally
. |
| 920000
1 | the application is not an administrator of the device
. |
| 920000
2 | the administrator application does not have permission to manage the device
. |
**示例:**
...
...
@@ -430,3 +430,421 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100).then(() => {
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
});
```
## bundleManager.addDisallowedInstallBundles
addDisallowedInstallBundles(admin: Want, appIds: Array
\<
string>, callback: AsyncCallback
<
void
>
): void;
指定设备管理员应用添加包安装黑名单接口,添加至黑名单的应用不允许安装,使用callback形式返回是否添加成功。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:**
SystemCapability.Customization.EnterpriseDeviceManager
**系统API**
: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| appIds | Array
<
string
>
| 是 | 不允许安装包的黑名单。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 |
**错误码**
:
以下的错误码的详细介绍请参见
[
企业设备管理错误码
](
../errorcodes/errorcode-enterpriseDeviceManager.md
)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
};
let
appIds
=
{
"
com.example.myapplication
"
};
bundleManager
.
AddDisallowedInstallBundles
(
wantTemp
,
appIds
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
});
```
## bundleManager.addDisallowedInstallBundles
addDisallowedInstallBundles(admin: Want, appIds: Array
\<
string>, userId: number, callback: AsyncCallback
<
void
>
): void;
指定设备管理员应用添加包安装黑名单接口,添加至黑名单的应用不允许在指定用户(通过userId指定)下安装,使用callback形式返回是否添加成功。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:**
SystemCapability.Customization.EnterpriseDeviceManager
**系统API**
: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| appIds | Array
<
string
>
| 是 | 不允许安装包的黑名单。 |
| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 |
**错误码**
:
以下的错误码的详细介绍请参见
[
企业设备管理错误码
](
../errorcodes/errorcode-enterpriseDeviceManager.md
)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
};
let
appIds
=
{
"
com.example.myapplication
"
};
bundleManager
.
AddDisallowedInstallBundles
(
wantTemp
,
appIds
,
100
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
});
```
## bundleManager.addDisallowedInstallBundles
addDisallowedInstallBundles(admin: Want, appIds: Array
\<
string>, userId?: number): Promise
<
void
>
;
指定设备管理员应用添加包安装黑名单接口。如果调用接口时传入了可选参数userId,则添加至黑名单的应用不允许在指定用户下安装;如果调用接口时没有传入参数userId,则添加至黑名单的应用不允许在当前用户下安装,使用promise形式返回是否添加成功。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:**
SystemCapability.Customization.EnterpriseDeviceManager
**系统API**
: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| appIds | Array
<
string
>
| 是 | 不允许安装包的黑名单。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ------------------------- |
| Promise
<
void
>
| 无返回结果的Promise对象。当指定设备管理员应用添加包安装黑名单失败时会抛出错误对象。 |
**错误码**
:
以下的错误码的详细介绍请参见
[
企业设备管理错误码
](
../errorcodes/errorcode-enterpriseDeviceManager.md
)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
};
let
appIds
=
{
"
com.example.myapplication
"
};
bundleManager
.
addDisallowedInstallBundles
(
wantTemp
,
appIds
,
100
).
then
(()
=>
{
console
.
log
(
"
success
"
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
});
```
## bundleManager.removeDisallowedInstallBundles
removeDisallowedInstallBundles(admin: Want, appIds: Array
\<
string>, callback: AsyncCallback
<
void
>
): void;
指定设备管理员应用移除包安装黑名单接口,在黑名单存在的情况下,在包安装黑名单中的应用不允许在当前用户下安装,使用callback形式返回移除结果。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:**
SystemCapability.Customization.EnterpriseDeviceManager
**系统API**
: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| appIds | Array
<
string
>
| 是 | 移除不允许安装包的黑名单。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 |
**错误码**
:
以下的错误码的详细介绍请参见
[
企业设备管理错误码
](
../errorcodes/errorcode-enterpriseDeviceManager.md
)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
};
let
appIds
=
{
"
com.example.myapplication
"
};
bundleManager
.
removeDisallowedInstallBundles
(
wantTemp
,
appIds
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
});
```
## bundleManager.removeDisallowedInstallBundles
removeAllowedInstallBundles(admin: Want, appIds: Array
\<
string>, userId: number, callback: AsyncCallback
<
void
>
): void;
指定设备管理员应用移除包安装黑名单接口,在黑名单存在的情况下,在包安装黑名单中的应用不允许在指定用户(通过userId指定)下安装,使用callback形式返回移除结果。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:**
SystemCapability.Customization.EnterpriseDeviceManager
**系统API**
: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| appIds | Array
<
string
>
| 是 | 不允许安装包的黑名单。 |
| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 |
**错误码**
:
以下的错误码的详细介绍请参见
[
企业设备管理错误码
](
../errorcodes/errorcode-enterpriseDeviceManager.md
)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
};
let
appIds
=
{
"
com.example.myapplication
"
};
bundleManager
.
removeDisallowedInstallBundles
(
wantTemp
,
appIds
,
100
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
});
```
## bundleManager.removeDisallowedInstallBundles
removeDisallowedInstallBundles(admin: Want, appIds: Array
\<
string>, userId?: number): Promise
<
void
>
;
指定设备管理员应用移除包安装黑名单接口。在黑名单存在的情况下,如果调用接口时传入参数userId,则在包安装黑名单中的应用不允许在指定用户下安装;如果调用接口时没有传入参数userId,则在包安装黑名单中的应用不允许在当前用户下安装,使用promise形式返回移除结果。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:**
SystemCapability.Customization.EnterpriseDeviceManager
**系统API**
: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| appIds | Array
\&
lt;string
>
| 是 | 不允许安装包的黑名单。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ------------------------- |
| Promise
<
void
>
| 无返回结果的Promise对象。当指定设备管理员应用移除包安装黑名单失败时会抛出错误对象。 |
**错误码**
:
以下的错误码的详细介绍请参见
[
企业设备管理错误码
](
../errorcodes/errorcode-enterpriseDeviceManager.md
)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
};
let
appIds
=
{
"
com.example.myapplication
"
};
bundleManager
.
removeDisallowedInstallBundles
(
wantTemp
,
appIds
,
100
).
then
(()
=>
{
console
.
log
(
"
success
"
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
});
```
## bundleManager.getDisallowedInstallBundles
getDisallowedInstallBundles(admin: Want, callback: AsyncCallback
<
Array
<
string
>>
): void;
指定管理员应用获取管理员用户下的包安装黑名单接口,使用callback形式返回获取包安装黑名单。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:**
SystemCapability.Customization.EnterpriseDeviceManager
**系统API**
: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| callback | AsyncCallback
<
Array
<
string
>>
| 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 |
**错误码**
:
以下的错误码的详细介绍请参见
[
企业设备管理错误码
](
../errorcodes/errorcode-enterpriseDeviceManager.md
)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
};
bundleManager
.
getDisallowedInstallBundles
(
wantTemp
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
});
```
## bundleManager.getDisallowedInstallBundles
getDisallowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback
<
Array
<
string
>>
): void;
指定管理员应用获取指定用户(通过userId指定)下的包安装黑名单接口,使用callback形式返回获取包安装黑名单。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:**
SystemCapability.Customization.EnterpriseDeviceManager
**系统API**
: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
| callback | AsyncCallback
<
Array
<
string
>>
| 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 |
**错误码**
:
以下的错误码的详细介绍请参见
[
企业设备管理错误码
](
../errorcodes/errorcode-enterpriseDeviceManager.md
)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
};
bundleManager
.
getDisallowedInstallBundles
(
wantTemp
,
100
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
});
```
## bundleManager.getDisallowedInstallBundles
getDisallowedInstallBundles(admin: Want, userId?: number): Promise
<
Array
<
string
>>
;
如果调用接口时传入参数userId,指定管理员应用获取指定用户下包安装黑名单接口。如果调用接口时没有传入参数userId,指定管理员应用获取当前用户下包安装黑名单接口,使用promise形式返回获取包安装黑名单。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:**
SystemCapability.Customization.EnterpriseDeviceManager
**系统API**
: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin |
[
Want
](
js-apis-app-ability-want.md
)
| 是 | 设备管理员应用。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ------------------------- |
| Promise
<
Array
<
string
>>
| Promise对象,返回管理员用户下的包安装白名单。 |
**错误码**
:
以下的错误码的详细介绍请参见
[
企业设备管理错误码
](
../errorcodes/errorcode-enterpriseDeviceManager.md
)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
};
bundleManager
.
getDisallowedInstallBundles
(
wantTemp
,
100
).
then
(()
=>
{
console
.
log
(
"
success
"
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录