From 0582032e919ef200c162242c6e6502efd1d1f625 Mon Sep 17 00:00:00 2001 From: scott Date: Sat, 24 Oct 2026 05:34:35 -0400 Subject: [PATCH] =?UTF-8?q?fix(airag):=20AI=20=E5=BA=94=E7=94=A8=E4=B8=8E?= =?UTF-8?q?=E8=AF=84=E4=BC=B0=E5=99=A8=EF=BC=88=E5=A4=96=E6=8C=82=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=EF=BC=89=E6=8E=A5=E5=8F=A3=E8=A1=A5=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=EF=BC=8C=E9=99=84=E6=8C=89=E9=92=AE=E6=9D=83?= =?UTF-8?q?=E9=99=90=E5=8D=87=E7=BA=A7=20SQL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../app/controller/AiragAppController.java | 4 +++ .../controller/AiragExtDataController.java | 12 +++++++ ...__add_airag_extdata_button_permissions.sql | 36 +++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.5_3__add_airag_extdata_button_permissions.sql diff --git a/jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/app/controller/AiragAppController.java b/jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/app/controller/AiragAppController.java index 2a8a7c6e1..90223fb99 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/app/controller/AiragAppController.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/app/controller/AiragAppController.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.base.controller.JeecgController; @@ -73,6 +74,7 @@ public class AiragAppController extends JeecgController> listDict(AiragApp airagApp, HttpServletRequest req) { QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(airagApp, req.getParameterMap()); queryWrapper.select("id", "name"); @@ -138,6 +140,7 @@ public class AiragAppController extends JeecgController release(@RequestParam(name = "id") String id, @RequestParam(name = "release") Boolean release, HttpServletRequest request) { @@ -194,6 +197,7 @@ public class AiragAppController extends JeecgController queryById(@RequestParam(name = "id", required = true) String id) { AiragApp airagApp = airagAppService.getById(id); if (airagApp == null) { diff --git a/jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/prompts/controller/AiragExtDataController.java b/jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/prompts/controller/AiragExtDataController.java index 7eb70fd74..20bff8ee9 100644 --- a/jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/prompts/controller/AiragExtDataController.java +++ b/jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/prompts/controller/AiragExtDataController.java @@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; @@ -50,6 +51,7 @@ public class AiragExtDataController extends JeecgController> queryPageList(AiragExtData airagExtData, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @@ -71,6 +73,7 @@ public class AiragExtDataController extends JeecgController> getTrackList(AiragExtData airagExtData, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @@ -95,6 +98,7 @@ public class AiragExtDataController extends JeecgController add(@RequestBody AiragExtData airagExtData) { airagExtData.setBizType(AiPromptsConsts.BIZ_TYPE_EVALUATOR); airagExtDataService.save(airagExtData); @@ -110,6 +114,7 @@ public class AiragExtDataController extends JeecgController edit(@RequestBody AiragExtData airagExtData) { airagExtDataService.updateById(airagExtData); return Result.OK("编辑成功!"); @@ -124,6 +129,7 @@ public class AiragExtDataController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { airagExtDataService.removeById(id); return Result.OK("删除成功!"); @@ -138,6 +144,7 @@ public class AiragExtDataController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.airagExtDataService.removeByIds(Arrays.asList(ids.split(","))); return Result.OK("批量删除成功!"); @@ -152,6 +159,7 @@ public class AiragExtDataController extends JeecgController queryById(@RequestParam(name="id",required=true) String id) { AiragExtData airagExtData = airagExtDataService.getById(id); if(airagExtData==null) { @@ -168,6 +176,7 @@ public class AiragExtDataController extends JeecgController> queryTrackById(@RequestParam(name="id",required=true) String id) { AiragExtData airagExtData = airagExtDataService.getById(id); String status = airagExtData.getStatus(); @@ -184,6 +193,7 @@ public class AiragExtDataController extends JeecgController debugEvaluator(@RequestBody AiragDebugVo debugVo) { return airagExtDataService.debugEvaluator(debugVo); } @@ -194,6 +204,7 @@ public class AiragExtDataController extends JeecgController importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, AiragExtData.class); } diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.5_3__add_airag_extdata_button_permissions.sql b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.5_3__add_airag_extdata_button_permissions.sql new file mode 100644 index 000000000..395b8e218 --- /dev/null +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.5_3__add_airag_extdata_button_permissions.sql @@ -0,0 +1,36 @@ +-- ---author:wangshuai---date:20261015-----for:AiragExtDataController(AI评估器)全部接口缺失权限注解,任意登录用户可越权读取/篡改/删除评估器和调用轨迹、调用模型;新增 airag:extData:* 按钮权限并授权给系统管理员角色(parent_id=2000880658872508417 为 AI评估器菜单) +-- 1. 新增按钮权限 +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000001', '2000880658872508417', '查询AI评估器列表', NULL, NULL, 0, NULL, NULL, 2, 'airag:extData:list', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000002', '2000880658872508417', '查询AI评估器调用轨迹列表', NULL, NULL, 0, NULL, NULL, 2, 'airag:extData:getTrackList', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000003', '2000880658872508417', '新增AI评估器', NULL, NULL, 0, NULL, NULL, 2, 'airag:extData:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000004', '2000880658872508417', '编辑AI评估器', NULL, NULL, 0, NULL, NULL, 2, 'airag:extData:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000005', '2000880658872508417', '删除AI评估器', NULL, NULL, 0, NULL, NULL, 2, 'airag:extData:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000006', '2000880658872508417', '批量删除AI评估器', NULL, NULL, 0, NULL, NULL, 2, 'airag:extData:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000007', '2000880658872508417', '按ID查询AI评估器', NULL, NULL, 0, NULL, NULL, 2, 'airag:extData:queryById', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000008', '2000880658872508417', '按ID查询AI评估器调用轨迹', NULL, NULL, 0, NULL, NULL, 2, 'airag:extData:queryTrackById', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000009', '2000880658872508417', 'AI评估器调试', NULL, NULL, 0, NULL, NULL, 2, 'airag:extData:debug', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000010', '2000880658872508417', '导出AI评估器', NULL, NULL, 0, NULL, NULL, 2, 'airag:extData:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000011', '2000880658872508417', '导入AI评估器', NULL, NULL, 0, NULL, NULL, 2, 'airag:extData:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); + +-- 2. 给系统管理员角色(f6817f48af4fb3af11b9e8bf182f618b)授权 +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000021', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000001', NULL, '2026-10-15 10:00:00', '127.0.0.1'); +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000022', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000002', NULL, '2026-10-15 10:00:00', '127.0.0.1'); +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000023', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000003', NULL, '2026-10-15 10:00:00', '127.0.0.1'); +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000024', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000004', NULL, '2026-10-15 10:00:00', '127.0.0.1'); +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000025', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000005', NULL, '2026-10-15 10:00:00', '127.0.0.1'); +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000026', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000006', NULL, '2026-10-15 10:00:00', '127.0.0.1'); +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000027', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000007', NULL, '2026-10-15 10:00:00', '127.0.0.1'); +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000028', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000008', NULL, '2026-10-15 10:00:00', '127.0.0.1'); +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000029', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000009', NULL, '2026-10-15 10:00:00', '127.0.0.1'); +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000030', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000010', NULL, '2026-10-15 10:00:00', '127.0.0.1'); +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000031', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000011', NULL, '2026-10-15 10:00:00', '127.0.0.1'); + +-- 3. AiragAppController queryById/release/listDict 独立权限(挂 AI应用管理菜单 1893865471550578689 下) +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000012', '1893865471550578689', '按ID查询AI应用', NULL, NULL, 0, NULL, NULL, 2, 'airag:app:queryById', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000013', '1893865471550578689', '发布/取消发布AI应用', NULL, NULL, 0, NULL, NULL, 2, 'airag:app:release', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); +INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`) VALUES ('2026101500000000014', '1893865471550578689', '查询AI应用字典', NULL, NULL, 0, NULL, NULL, 2, 'airag:app:listDict', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-10-15 10:00:00', NULL, NULL, 0, 0, '1', 0); + +-- 4. 授权给系统管理员角色(f6817f48af4fb3af11b9e8bf182f618b) +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000032', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000012', NULL, '2026-10-15 10:00:00', '127.0.0.1'); +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000033', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000013', NULL, '2026-10-15 10:00:00', '127.0.0.1'); +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`) VALUES ('2026101500000000034', 'f6817f48af4fb3af11b9e8bf182f618b', '2026101500000000014', NULL, '2026-10-15 10:00:00', '127.0.0.1');