diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-date-time.md b/zh-cn/application-dev/reference/apis/js-apis-system-date-time.md index 336b6fefcd4be7da7843408c25b8245838dcf607..4425da3b8297899f2e2bcf8ef5a311c6b4893d57 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-system-date-time.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-date-time.md @@ -22,6 +22,8 @@ setTime(time : number, callback : AsyncCallback<void>) : void **系统能力:** SystemCapability.MiscServices.Time +**需要权限:** ohos.permission.SET_TIME + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -57,6 +59,8 @@ setTime(time : number) : Promise<void> **系统能力:** SystemCapability.MiscServices.Time +**需要权限:** ohos.permission.SET_TIME + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -380,6 +384,8 @@ setDate(date: Date, callback: AsyncCallback<void>): void **系统能力:** SystemCapability.MiscServices.Time +**需要权限:** ohos.permission.SET_TIME + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -414,6 +420,8 @@ setDate(date: Date): Promise<void> **系统能力:** SystemCapability.MiscServices.Time +**需要权限:** ohos.permission.SET_TIME + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -509,6 +517,8 @@ setTimezone(timezone: string, callback: AsyncCallback<void>): void **系统能力:** SystemCapability.MiscServices.Time +**需要权限:** ohos.permission.SET_TIME_ZONE + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -542,6 +552,8 @@ setTimezone(timezone: string): Promise<void> **系统能力:** SystemCapability.MiscServices.Time +**需要权限:** ohos.permission.SET_TIME_ZONE + **参数:** | 参数名 | 类型 | 必填 | 说明 | diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.10.2/changelogs-time.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.10.2/changelogs-time.md new file mode 100644 index 0000000000000000000000000000000000000000..af9a9d469f68528a9fe98e54c0994e5d2c62d20f --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.10.2/changelogs-time.md @@ -0,0 +1,31 @@ +# 时间时区子系统ChangeLog + +## cl.time.1 setTime、setDate、setTimezone接口新增权限校验 + +此前版本设置时间、设置日期及设置时区接口对调用方只进行系统API校验,未进行权限校验,存在安全风险,不符合OpenHarmony的API接口规范。 +现做出如下变更: + - 调用方使用setTime方法前需提前申请"ohos.permission.SET_TIME"权限。 + - 调用方使用setDate方法前需提前申请"ohos.permission.SET_TIME"权限。 + - 调用方使用setTimezone方法前需提前申请"ohos.permission.SET_TIME_ZONE"权限。 + +**变更影响** + +基于此前版本开发的应用,需提前申请相应权限,否则无法正常调用接口,影响原有业务逻辑。 + +**关键的接口/组件变更** + +涉及接口 + + - systemDateTime.setTime; + - systemDateTime.setDate; + - systemDateTime.setTimezone; + +变更前: + - 接口无需任何权限限制可正常调用。 + +变更后: + - 接口需要申请相应权限才可正常调用,若权限使用有误,将返回201表示权限否定异常。 + +**适配指导** + +调用setTime、setDate、setTimezone接口时,需申请相应的权限才可正常使用。