diff --git a/CHANGELOG.md b/CHANGELOG.md index ce39197672..59c6658fa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,33 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.4.4](https://github.com/nocobase/nocobase/compare/v1.4.3...v1.4.4) - 2024-12-08 + +### 🐛 Bug Fixes + +- **[client]** + - Fix issue with external data source fields not display in table block ([#5825](https://github.com/nocobase/nocobase/pull/5825)) by @katherinehhh + + - Fix display issue for inherited fields in form configuration ([#5822](https://github.com/nocobase/nocobase/pull/5822)) by @katherinehhh + + - Fix inherited fields not appear in field list and cannot override ([#5800](https://github.com/nocobase/nocobase/pull/5800)) by @katherinehhh + +- **[Data visualization]** Fix the issue when formatting timezone-aware date fields in MySQL ([#5829](https://github.com/nocobase/nocobase/pull/5829)) by @2013xile + +- **[Workflow]** + - Fix transaction across data sources which cause collection event error ([#5818](https://github.com/nocobase/nocobase/pull/5818)) by @mytharcher + + - Fix date type missed in date field based schedule configuration ([#5816](https://github.com/nocobase/nocobase/pull/5816)) by @mytharcher + +- **[Collection field: Many to many (array)]** Fix the issue where updating m2m array fields in single relation collection does not take effect ([#5820](https://github.com/nocobase/nocobase/pull/5820)) by @2013xile + +- **[Calendar]** + - Fix error when clicking on a blank date in the calendar ([#5803](https://github.com/nocobase/nocobase/pull/5803)) by @katherinehhh + + - Fix the issue where closing a popup opened through the 'Calendar Block' causes all popups to close ([#5793](https://github.com/nocobase/nocobase/pull/5793)) by @zhangzhonghe + +- **[Public forms]** Fix incorrect QC code scan path in sub-application public form ([#5799](https://github.com/nocobase/nocobase/pull/5799)) by @katherinehhh + ## [v1.4.3](https://github.com/nocobase/nocobase/compare/v1.4.2...v1.4.3) - 2024-12-05 ### 🚀 Improvements diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 41e93faba4..89d00b454f 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -5,6 +5,33 @@ 格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/), 并且本项目遵循 [语义化版本](https://semver.org/spec/v2.0.0.html)。 +## [v1.4.4](https://github.com/nocobase/nocobase/compare/v1.4.3...v1.4.4) - 2024-12-08 + +### 🐛 修复 + +- **[client]** + - 修复表格区块中外部数据源字段列表没有显示 ([#5825](https://github.com/nocobase/nocobase/pull/5825)) by @katherinehhh + + - 修复表单配置字段继承字段的显示问题 ([#5822](https://github.com/nocobase/nocobase/pull/5822)) by @katherinehhh + + - 修复表继承缺陷:字段列表未显示继承表字段且在数据表中无法重写继承字段 ([#5800](https://github.com/nocobase/nocobase/pull/5800)) by @katherinehhh + +- **[数据可视化]** 修复在 MySQL 中格式化带时区的日期字段的问题 ([#5829](https://github.com/nocobase/nocobase/pull/5829)) by @2013xile + +- **[工作流]** + - 修复由于事务引起的外部数据源数据表同步事件触发错误 ([#5818](https://github.com/nocobase/nocobase/pull/5818)) by @mytharcher + + - 修复定时任务时间字段配置中缺少的日期类型 ([#5816](https://github.com/nocobase/nocobase/pull/5816)) by @mytharcher + +- **[数据表字段:多对多 (数组)]** 修复更新对一关联表中多对多(数组)字段不生效的问题 ([#5820](https://github.com/nocobase/nocobase/pull/5820)) by @2013xile + +- **[日历]** + - 修复日历点击空白日期时报错的问题 ([#5803](https://github.com/nocobase/nocobase/pull/5803)) by @katherinehhh + + - 修复关闭通过“日历区块”打开的弹窗,导致所有弹窗都关闭的问题 ([#5793](https://github.com/nocobase/nocobase/pull/5793)) by @zhangzhonghe + +- **[公开表单]** 修复子应用中公开表 QC code 扫码打开路径不正确 ([#5799](https://github.com/nocobase/nocobase/pull/5799)) by @katherinehhh + ## [v1.4.3](https://github.com/nocobase/nocobase/compare/v1.4.2...v1.4.3) - 2024-12-05 ### 🚀 优化 diff --git a/packages/core/client/src/api-client/APIClient.ts b/packages/core/client/src/api-client/APIClient.ts index 237a25955d..d97ccc369e 100644 --- a/packages/core/client/src/api-client/APIClient.ts +++ b/packages/core/client/src/api-client/APIClient.ts @@ -109,10 +109,15 @@ export class APIClient extends APIClientSDK { // TODO(yangqia): improve error code and message if (errs.find((error: { code?: string }) => error.code === 'ROLE_NOT_FOUND_ERR')) { this.auth.setRole(null); + window.location.reload(); } if (errs.find((error: { code?: string }) => error.code === 'TOKEN_INVALID')) { this.auth.setToken(null); } + if (errs.find((error: { code?: string }) => error.code === 'ROLE_NOT_FOUND_FOR_USER')) { + this.auth.setRole(null); + window.location.reload(); + } throw error; }, ); diff --git a/packages/core/client/src/locale/zh-CN.json b/packages/core/client/src/locale/zh-CN.json index 6b4ef9d02d..339edcd513 100644 --- a/packages/core/client/src/locale/zh-CN.json +++ b/packages/core/client/src/locale/zh-CN.json @@ -1033,5 +1033,6 @@ "Search plugin...": "搜索插件...", "Package name": "包名", "Associate":"关联", - "Please add or select record":"请添加或选择数据" + "Please add or select record":"请添加或选择数据", + "No data":"暂无数据" } diff --git a/packages/core/client/src/schema-component/antd/association-field/SubTable.tsx b/packages/core/client/src/schema-component/antd/association-field/SubTable.tsx index 0c51c1f620..7a4c239c3d 100644 --- a/packages/core/client/src/schema-component/antd/association-field/SubTable.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/SubTable.tsx @@ -241,7 +241,9 @@ export const SubTable: any = observer( pagination={paginationConfig} rowSelection={{ type: 'none', hideSelectAll: true }} isSubTable={true} - locale={{ emptyText: {t('Please add or select record')} }} + locale={{ + emptyText: {field.editable ? t('Please add or select record') : t('No data')}, + }} /> {field.editable && ( { expect(ctx.state.currentRole).toBe('root'); }); - it('should use default role when the role does not belong to the user', async () => { + it('should throw error', async () => { ctx.state.currentUser = await db.getRepository('users').findOne({ appends: ['roles'], }); @@ -79,7 +79,10 @@ describe('role', () => { const throwFn = vi.fn(); ctx.throw = throwFn; await setCurrentRole(ctx, () => {}); - expect(ctx.state.currentRole).toBe('root'); + expect(throwFn).lastCalledWith(401, { + code: 'ROLE_NOT_FOUND_FOR_USER', + message: 'The role does not belong to the user', + }); }); it('should set role with anonymous', async () => { diff --git a/packages/plugins/@nocobase/plugin-acl/src/server/middlewares/setCurrentRole.ts b/packages/plugins/@nocobase/plugin-acl/src/server/middlewares/setCurrentRole.ts index 2a607b71b2..abe3f416f2 100644 --- a/packages/plugins/@nocobase/plugin-acl/src/server/middlewares/setCurrentRole.ts +++ b/packages/plugins/@nocobase/plugin-acl/src/server/middlewares/setCurrentRole.ts @@ -50,6 +50,12 @@ export async function setCurrentRole(ctx: Context, next) { // 1. If the X-Role is set, use the specified role if (currentRole) { role = userRoles.find((role) => role.name === currentRole)?.name; + if (!role) { + return ctx.throw(401, { + code: 'ROLE_NOT_FOUND_FOR_USER', + message: ctx.t('The role does not belong to the user', { ns: 'acl' }), + }); + } } // 2. If the X-Role is not set, or the X-Role does not belong to the user, use the default role if (!role) {