Skip to content

feat: add CoursewareViewStarted, CourseStartDateValidationFailed, and CoursewareAccessChecksRequested filters#336

Open
pwnage101 wants to merge 1 commit into
openedx:mainfrom
pwnage101:pwnage101/ENT-11544
Open

feat: add CoursewareViewStarted, CourseStartDateValidationFailed, and CoursewareAccessChecksRequested filters#336
pwnage101 wants to merge 1 commit into
openedx:mainfrom
pwnage101:pwnage101/ENT-11544

Conversation

@pwnage101

@pwnage101 pwnage101 commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Comment thread openedx_filters/learning/filters.py Outdated
@pwnage101 pwnage101 force-pushed the pwnage101/ENT-11544 branch 3 times, most recently from 7e9d307 to 75be6aa Compare May 15, 2026 19:25
@pwnage101 pwnage101 force-pushed the pwnage101/ENT-11544 branch from 75be6aa to 39c6daf Compare May 21, 2026 16:46
@pwnage101 pwnage101 force-pushed the pwnage101/ENT-11544 branch 8 times, most recently from f11df07 to b80e6ce Compare June 2, 2026 23:37
@pwnage101 pwnage101 changed the title feat: add CoursewareViewRedirectURL filter feat: add CoursewareViewStarted, CourseStartDateValidationFailed, and CoursewareAccessChecksRequested filters Jun 2, 2026
@pwnage101 pwnage101 marked this pull request as ready for review June 2, 2026 23:39
Comment thread openedx_filters/learning/filters.py Outdated
Comment thread CHANGELOG.rst
Comment thread openedx_filters/learning/filters.py
@pwnage101 pwnage101 force-pushed the pwnage101/ENT-11544 branch 5 times, most recently from ca033ae to ed2af98 Compare June 4, 2026 17:52
… CoursewareAccessChecksRequested filters

Plugins can now supply a courseware view redirect URL, inject specific error
payloads when course start-date validation fails, or deny courseware access
with a priority (non-bypassable) error.

ENT-11544
@pwnage101 pwnage101 force-pushed the pwnage101/ENT-11544 branch from ed2af98 to a78948c Compare June 4, 2026 19:29
@pwnage101

pwnage101 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

@felipemontoya this is now ready for your review. For reference, the proposed call sites for all 3 added filters can be found in the draft platform PR.

Also, other unrelated repo cleanup stuff:

  • Updated all outdated references openedx/edx-platform -> openedx/openedx-platform
  • Fixed CHANGELOG.rst:
    • Deleted all the fragments under changelog.d/ since they are supposed to be deleted automatically by make changelog.
    • Manually incorporated those deleted fragments into CHANGELOG.rst.
    • Fixed a bunch of broken and malformed changelog entries (missing headers, wrong dates, etc.)
    • Added my own changelog entry using the new make changelog-entry / make changelog mechanism.

@felipemontoya

Copy link
Copy Markdown
Member

Reviewing now.

For future reference @pwnage101, whenever you need to do a lot of cosmetic changes its better to keep those in a separate PR. Those I can merge easily and that makes reviewing the actual change in the filters easier.

@felipemontoya felipemontoya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall the 3 filters make are well defined, correctly documented and are new places in the platform cycle not covered by previous filters. I'd like to hear from the RBAC devs before merging but otherwise I approve.

return data["context"], data["user_id"], data["course_id"]


class CoursewareViewStarted(OpenEdxPublicFilter):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This filter makes a lot of sense to me.

If I understand correctly this goes first in the stack, right?

1. CoursewareViewStarted
2. VerticalBlockChildRenderStarted
3. Loop over RenderXBlockStarted
4. VerticalBlockRenderCompleted 

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To be completely honest, I don't 100% know. My goal with this ticket is a 1:1 replacement, so I'm pretty laser focused on replacing the exact call sites. That said, filter naming is important, so it is a good idea to understand the code path to come up with a self-documenting name.

The best I can tell, there are 2 code paths that can trigger a DSC redirect when a learner views courseware (legacy vs. MFE), and they use different filters:

Legacy (server-rendered) courseware views:

  1. CoursewareViewStarted (view decorator / WikiAccessMiddleware)
    • If DSC redirect is needed, returns an HTTP redirect here.
  2. loop over VerticalBlockChildRenderStarted
  3. VerticalBlockRenderCompleted

Learning MFE — two separate requests:

  • Request A — course_home_api/course_metadata BFF call:
    1. CoursewareAccessChecksRequested (from check_course_access)
      • If DSC redirect is needed, returns the error_code = data_sharing_access_required and developer_message = <consent URL> in API response.
      • MFE reads developerMessage as the consent redirect URL, performs redirect via javascript.
  • Request B — render_xblock:
    1. RenderXBlockStarted
    2. loop over VerticalBlockChildRenderStarted
    3. VerticalBlockRenderCompleted


Trigger:
- Repository: openedx/openedx-platform
- Path: lms/djangoapps/courseware/access_utils.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you think this must connect with the RBAC project in any meaningful way?

@mariajgrimaldi or @BryanttV do you see any cause for concern with a filter like this?

@pwnage101 pwnage101 Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, this is the first I've heard of the "RBAC project" (openedx/openedx-authz), having only contributed to openedx/edx-rbac which we use extensively to manage role-based authorization for all of our enterprise IDAs.


class CoursewareAccessChecksRequested(OpenEdxPublicFilter):
"""
Filter triggered during courseware access checks so plugins can deny access.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This filter also makes a lot of sense to me. I'd also like to see how this interacts with RBAC for future-proofing purposes.

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.

4 participants