Skip to content

Commit

Permalink
feat: remove staff access in courses for catalog views (#37)
Browse files Browse the repository at this point in the history
* feat: remove staff access for catalog views

This is controversial, but simple. To do this in a monkey patch is a bigger task and also with
more work. Is different due the change is in a nested function. Anyway the alternative is to
monkeyPatch the _dispatch method and handle there. But its risky and also that method manage other permission with different ways.

* feat: keep custom test with default behavior

To use you configure the setting: `STAFF_CAN_SEE_IN_CATALOG`
  • Loading branch information
johanseto authored Sep 16, 2024
1 parent c22ca47 commit 3381de6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lms/djangoapps/courseware/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,10 @@ def can_see_in_catalog():
"""
return (
_has_catalog_visibility(courselike, CATALOG_VISIBILITY_CATALOG_AND_ABOUT)
or _has_staff_access_to_descriptor(user, courselike, courselike.id)
or (
_has_staff_access_to_descriptor(user, courselike, courselike.id)
and getattr(settings, "STAFF_CAN_SEE_IN_CATALOG", True)
)
)

@function_trace('can_see_about_page')
Expand Down

0 comments on commit 3381de6

Please sign in to comment.