Skip to content

Reindex button hidden for non-Global-Staff users with valid AuthZ course-authoring permissions #482

Closed
openedx/openedx-platform
#39144

Description

@BryanttV

Description

The visibility of the "Reindex" button in Studio's course outline (course-authoring MFE) is controlled by the reindex_link field returned by CourseIndexView, computed in _get_course_index_context. This check is hardcoded to GlobalStaff only, regardless of whether the AuthZ course-authoring flag (authz.enable_course_authoring) is enabled and regardless of the requesting user's AuthZ permissions.

Meanwhile, the actual reindex action (course_search_index_handler → reindex_course_and_check_access in cms/djangoapps/contentstore/views/course.py) already supports AuthZ: when the flag is enabled, it grants access based on the COURSES_PUBLISH_COURSE_CONTENT permission, which non-Global-Staff roles (e.g. course_staff, course_admin) can hold.

This mismatch means a user who is authorized to trigger a reindex (via AuthZ) never sees the button that would let them do it from the UI.

Current behavior

  • With ENABLE_COURSEWARE_INDEX on and the AuthZ course-authoring flag enabled, a user with the course_staff (or course_admin) AuthZ role — but who is not Global Staff — does not see the "Reindex" button in the Course Outline page, even though they could successfully trigger a reindex by hitting the search_reindex endpoint directly.
  • Only Global Staff (superusers) ever see the button, regardless of AuthZ state.

Expected behavior

  • The "Reindex" button's visibility should be governed by the same access rules as the reindex action itself: when AuthZ course-authoring is enabled, any user holding COURSES_PUBLISH_COURSE_CONTENT for the course should see the button; when AuthZ is disabled, the legacy Global-Staff-only restriction should still apply.

Steps to reproduce

  1. Enable ENABLE_COURSEWARE_INDEX in CMS.
  2. Enable the authz.enable_course_authoring waffle flag (globally or for the target course).
  3. Assign a non-Global-Staff user the course_staff AuthZ role in a course.
  4. Log in to Studio as that user and open the course's Course Outline page.
  5. Observe that the Reindex button is not shown, even though a GET to /course/{course_id}/search_reindex as that user succeeds

Metadata

Metadata

Assignees

Labels

willow

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions