Skip to content

Guard Pages & Resources course-app settings routes for view-only users #595

Done
openedx/frontend-app-authoring
#3356

Description

@BryanttV

Description

All course-app settings in Pages & Resources open through the same route, /pages-and-resources/:appId/settings, which loads the matching @openedx-plugins/course-app-<appId> package from plugins/course-apps. For view-only users (view_pages_and_resources without manage_pages_and_resources, e.g. a course auditor) the settings button is hidden, but the route has no permission check, so the modal can still be opened through a deep link.

Current Behavior

Opening /pages-and-resources/<appId>/settings as a view-only user shows the settings modal. What the user sees depends on the plugin:

  • Plugins built on AppSettingsModal (e.g. Progress, Calculator) read isEditable from PagesAndResourcesContext and disable their controls, so the modal is read-only.
  • Plugins with a custom modal (e.g. ORA, Proctoring, Xpert unit summaries) do not read isEditable, so the modal opens with all options enabled (e.g. /pages-and-resources/ora_settings/settings). Saving fails only because the backend rejects the request.

Expected Behavior

A view-only user who navigates to a settings route is redirected to Pages & Resources and no settings modal is shown, regardless of how the plugin implements its modal.

Steps to reproduce

  1. Log in as a user with view_pages_and_resources but without manage_pages_and_resources (e.g. course auditor).
  2. Open /pages-and-resources/ora_settings/settings directly.
  3. Observe that the modal opens with all options enabled; saving fails with a backend error.

Acceptance Criteria

  • The :appId/settings routes and the Discussions settings routes in PagesAndResources require the manage permission.
  • View-only users who open these routes by URL are redirected to Pages & Resources and no modal is shown.
  • Users with the manage permission can still open every settings modal.
  • Custom Pages (/custom-pages, which is only reachable from its own entry point) disables its actions based on manage.pages_and_resources.
  • Tests are added or updated.

Proposed Solution

  1. Preferred: guard the settings routes with the manage permission.
  2. Alternative: complete the isEditable validation in each custom modal, as AppSettingsModal already does.

Notes or Additional Context

The route guard only covers course apps installed at build time from plugins/course-apps (or other @openedx-plugins/course-app-* packages). Plugins added through a plugin slot (e.g. additional_course_plugin) do not use routes and open their own UI, so they must check permissions themselves, for example by reading isEditable from PagesAndResourcesContext.

Related: #286

Metadata

Metadata

Assignees

Labels

willow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions