diff --git a/college/__manifest__.py b/college/__manifest__.py index ef7efdd..f521aa9 100644 --- a/college/__manifest__.py +++ b/college/__manifest__.py @@ -1,6 +1,6 @@ { 'name': '教育', - 'version': '18.0.3.2.0', + 'version': '18.0.3.3.0', 'summary': 'Odoo 18 教学管理平台 — 师生管理 + 课程管理 + 作业/进展(老师·学生双角色)', 'description': """ Odoo 18 教学管理平台(面向老师与学生,双角色权限) @@ -63,7 +63,11 @@ 'college/static/src/js/hide_user_menu_items.js', 'college/static/src/js/hide_activity_menu.js', 'college/static/src/js/portal_indicator.js', + 'college/static/src/js/hide_about_edit.js', + 'college/static/src/scss/hide_about_edit.scss', 'college/static/src/xml/portal_indicator.xml', + 'college/static/src/js/module_list_cap.js', + 'college/static/src/xml/module_list_pager.xml', ], 'web.assets_web_dark': [ 'college/static/src/scss/college_theme_dark.scss', diff --git a/college/controllers/exam_controller.py b/college/controllers/exam_controller.py index c735a96..d782760 100644 --- a/college/controllers/exam_controller.py +++ b/college/controllers/exam_controller.py @@ -16,12 +16,29 @@ class ExamController(http.Controller): """学生答题卡式考试页面控制器。""" def _check_paper_access(self, paper_id, states=None): - """校验当前登录用户是否为该答卷的学员本人。""" + """校验当前登录用户是否为该答卷的学员本人。 + + 兼容两种身份关联方式: + - 答卷已关联登录账号(paper.user_id)的,直接用账号比对; + - 答卷未关联账号(如学生档案尚未绑定账号)的,通过当前登录账号 + 反向查找对应的学生档案,再与学生答卷的 student_id 比对。 + """ paper = request.env['yuthon.school.exam.paper'].sudo().browse(paper_id) if not paper.exists(): raise http.NotFound() - if paper.user_id.id != request.env.user.id: + + current_user = request.env.user + if paper.user_id and paper.user_id.id != current_user.id: raise AccessError('您无权访问该答卷。') + + if not paper.user_id: + # 答卷未绑定账号时,尝试用当前登录账号找到对应学生档案 + current_student = request.env['yuthon.school.student'].sudo().search([ + ('user_id', '=', current_user.id) + ], limit=1) + if not current_student or current_student.id != paper.student_id.id: + raise AccessError('您无权访问该答卷。') + if states and paper.state not in states: raise UserError('当前答卷状态不允许该操作。') return paper diff --git a/college/data/about_pages.xml b/college/data/about_pages.xml index f0d93f2..4d81631 100644 --- a/college/data/about_pages.xml +++ b/college/data/about_pages.xml @@ -103,8 +103,7 @@
面向高校与职业院校的工程化 Python 实训平台,把企业真实开发场景搬进课堂
@@ -231,7 +230,7 @@