Fix XBlock studio handler silently dropping Course Editor writes

オープン
#598 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
66/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python

調査の方向性

Start in views/component.py at component_handler around line 567 and trace how it checks course edit permission and calls update_item. Read the existing handler tests and add coverage for Course Editor writes and callers whose changed fields must receive 403. Done means permitted edits persist and unauthorized changed requests no longer return success.

索引モデルが issue の本文から書いたものです。

説明

willow
Description

When an XBlock studio handler (e.g. Drag and Drop, Survey) is called by a Course Editor, the changes are not persisted, yet the handler returns 200 and the UI reports success. This is silent data loss.

Current Behavior

component_handler (views/component.py:567) decides whether to persist using the legacy has_course_author_access. Editors have no legacy role (LEGACY_COURSE_ROLE_EQUIVALENCES does not include them), so update_item is skipped and only a warning is logged. The response is still 200.

Expected Behavior

Editors' changes are persisted. Callers without permission get an explicit 403 instead of a fake success.

Steps to reproduce
  1. Log in as a Course Editor.
  2. Edit a Drag and Drop (or Survey) component and save.
  3. Observe the success message, then reload and see the change was not saved.
Acceptance Criteria
  • component_handler persists with update_item when user_has_course_permission(request.user, COURSES_EDIT_COURSE_CONTENT.identifier, usage_key.course_key, LegacyAuthoringPermission.WRITE) is true.
  • When the user lacks permission and the handler changed fields, the response is 403 rather than a silent 200.
  • Editor edits to these XBlocks persist.
  • Tests are added or updated.
Proposed Solution
if user_has_course_permission(
    request.user, COURSES_EDIT_COURSE_CONTENT.identifier,
    usage_key.course_key, LegacyAuthoringPermission.WRITE,
):
    modulestore().update_item(block, request.user.id, asides=asides)

The else branch should return 403, at least when the handler actually changed fields.

主要言語
Python
スター
0
フォーク
10
平均マージ
5日 9時間
マージ済み PR(30日)
24

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

openedx/openedx-authz のほかの issue

openedx/openedx-authz の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。