Skip to content

Conversation

@ccantillo
Copy link
Collaborator

Description

This PR adds role-based visibility control for the course unit publish button. Previously, all course team members could see and use the publish button. Now, the button is hidden by default for staff members, while instructors continue to see it.

Why this change?
In many Open edX deployments, staff members shouldn't have the ability to publish content - that responsibility should be limited to instructors who have oversight of the course. This change enforces that separation of concerns at the UI level.

How it works:

  • When a user opens a course unit, we fetch their role from the course team API
  • If they're a staff member (or if we can't determine their role), the publish button is hidden
  • If they're an instructor, the button displays normally
  • We've wrapped the publish button in a new plugin slot, so operators can customize this behavior via frontend plugins if needed

User roles impacted:

  • Course Staff: Will no longer see the publish button (hidden by default)
  • Course Instructors: No change - continue to see and use the publish button
  • Operators: Can now customize publish button behavior via the new plugin slot

Supporting information

This change introduces a new plugin slot: org.openedx.frontend.authoring.course_unit_publish_button.v1

The role check uses the existing course team API endpoint (/api/contentstore/v1/course_team/{courseId}), so no backend changes are required.

Testing instructions

Manual testing steps:

  1. Create a test course and add two users to the course team:

    • User A with "Staff" role
    • User B with "Admin" (Instructor) role
  2. Log in as User A (staff):

    • Navigate to any course unit in Studio
    • Open the unit sidebar
    • Expected: The "Publish" button should NOT be visible
  3. Log in as User B (instructor):

    • Navigate to the same course unit
    • Open the unit sidebar
    • Expected: The "Publish" button should be visible and functional
  4. Test the plugin slot (optional for operators):

    • Create a frontend plugin that replaces the publish button slot
    • Verify your custom component receives the correct props (courseRole, published, hasChanges, etc.)

Other information

Dependencies:

  • None - uses existing course team API

Breaking changes:

  • Staff members will lose access to the publish button UI. If your deployment needs staff to publish, you'll need to either

@ccantillo ccantillo requested a review from johanseto December 30, 2025 20:03
Copy link
Collaborator

@johanseto johanseto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a first iteration. Could you fix the lintern issues to pass the validate.ci tests.

https://github.com/nelc/frontend-app-authoring/actions/runs/20604854970/job/59178340073#step:4:93

@ccantillo ccantillo force-pushed the crls/delete-publish-button branch from 0897bfe to adddb99 Compare January 4, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants