Commit Graph

6222 Commits

Author SHA1 Message Date
leoaulasneo98
0a05dc292b Saml redirect mfe (#36197)
* fix: Redirect non-enterprise SAML to authn MFE

The original request was that enterprise users with tpa hint and SAML should not be redirected to MFE. The current condition also excludes regular non-enterprise users with SAML authentication from the MFE.

* test: Add test for enterprise SAML authentication MFE redirection logic

This test validates the conditional redirection to the authentication
microfrontend (MFE) for enterprise and SAML authentication scenarios.

The test covers different combinations of:
- Enterprise customer presence
- Third-party authentication provider
- SAML provider status
- Redirection setting

Ensures that enterprise customers with SAML providers are not redirected
to the authentication MFE, while other scenarios follow the standard
redirection rules.

* fix: change spaced between line codes in test_logistration.py

---------

Co-authored-by: Andrés González <andres@aulasneo.com>
2025-03-11 12:27:51 -04:00
zawan-ila
ab3928284f feat: only fetch published pathways (#36332)
* feat: only fetch published pathways
2025-03-07 12:42:33 +05:00
Emad Rad
40a4a718c0 chore: fixed typo 2025-03-06 10:46:43 -05:00
Emad Rad
1b1a8fa047 fix: Add username generation tests and utility functions
- Introduced `remove_special_characters_from_name` and `generate_username_suggestions` functions to enhance username handling.
- Added comprehensive test cases for username generation, including ASCII validation and uniqueness checks.
- Implemented tests for special character removal and suggestion generation based on various input scenarios, including edge cases.
2025-03-06 10:46:43 -05:00
Emad Rad
c544550a8d fix: Enhance username suggestion generation with ASCII validation and detailed docstring
- Updated `generate_username_suggestions` function to include validation for non-ASCII characters.
- Improved function documentation to clarify arguments, return types, and username generation logic.
- Added type hints for better code clarity and maintainability.
2025-03-06 10:46:43 -05:00
Chris Chávez
475d61729b feat: Enable library blocks using settings [FC-0076] (#36292)
LIBRARY_ENABLED_BLOCKS added to verify enabled blocks in get_allowed_block_types
2025-03-05 12:45:43 -05:00
David Ormsbee
d5aa834b6c refactor: move get_user_model call out of method
The get_service_user method used to do a local call to the
get_user_model function because it was not guaranteed to be properly
initialized at the time of import. This was partly due to how we did
custom initialization using lms/startup.py, but it was also because
when it was implemented (commit f318661), the platform was still
running on Django 1.8.18. At that time, get_user_model was guaranteed to
work only after Django has imported all models.

In Django 1.11, the behavior of get_user_model was changed:

  https://docs.djangoproject.com/en/1.11/releases/1.11/#django-contrib-auth

> get_user_model() can now be called at import time,
> even in modules that define models.

Now that lms/startup.py is gone and get_user_model is safe to call at
the module level, I'm refactoring the catalog app's models.py file to
follow the convention we use everywhere else in edx-platform with
respect to get_user_model.
2025-02-28 23:16:05 -05:00
David Ormsbee
c4f21b6931 fix: remove custom startup to fix dev reloading
The cms/startup.py and lms/startup.py files were created to
allow us to do a lot of custom initialization around things
like the ModuleStore, monkey-patching, adding MIME types to
our process, etc. As far back as 2017, we recognized that
this was a bad thing, marked these modules as "deprecated",
and started removing things or putting them in the standard
Django locations for them (0279181).

In its current state, these startup modules no longer do any
custom work, and just invoke django.startup(). But this is
meant for running Django code in "standalone" usage, e.g. if
you have a script that isn't a management command but needs
some Django functionality.

The "runserver" command used during development normally
launches a child process to serve requests and knows how to
kill and respawn that process when files are modified, so
that changes are reflected. It can also normally handle the
case where there's a SyntaxError in the child process, and
fixing that error will reload the code again.

Something about running django.startup() manually interferes
with this functionality in "runserver". It still reloads the
code in response to changes, but if the code gets into a
broken state for any reason (like a syntax error), the master
process itself dies. That causes the container to restart,
only to die again shortly afterwards in a loop until the
error is fixed. The container restarts will break any shell
you had opened into the container, as well as any IDE
integrations that connected to that container to access the
files and Python instance.

Getting rid of the custom startup code fixes this and moves
us one small step closer to being a more normal Django
project.
2025-02-28 23:16:05 -05:00
Hassan Raza
35243385eb fix: track duplicate unsubscribe events in snowflake by adding preference updates (#36299)
Co-authored-by: Hassan Raza <h.raza@A006-01472.local>
2025-02-27 11:42:38 +05:00
Chris Chávez
b6489e718c feat: Video editor supports transcripts [FC-0076] (#36058)
* Add error handler on save video to avoid creating sjson
* Support transcripts without edx_video_id in definition_to_xml
* When copying a video from a library to a course: Create a new edx_video_id
* Save transcripts as static assets in a video in a library when adding a new transcript.
* Delete transcripts as static assets in a video in a library when deleting transcripts.
* Support download transcript in a video in a library.
* Support replace transcript in a video in a library.
* Support updating transcripts in video in a library.
* Refactor the code of downloading YouTube transcripts to enable this feature in libraries.
* Support copy from a library to a course and a course to a library.
2025-02-21 13:33:13 -05:00
Hassan Raza
5db14d2b5b fix: tracker context issue (#36247)
Co-authored-by: Hassan Raza <h.raza@192.168.1.12>
2025-02-18 15:12:35 +05:00
Jillian
c02e567201 Make copied tags editable again after breaking the upstream link to library content [FC-0076] (#36228)
When deleting an upstream library block, ensure that any tags that may have been copied to downstream blocks are made editable again. This is achieved by un-setting the `is_copied` flag on the downstream tags.
2025-02-13 11:53:05 -05:00
Irtaza Akram
a8a8ae3286 fix: replace pkg_resources with importlib.resources (#36213) 2025-02-13 17:43:07 +05:00
Rômulo Penido
a8ad9c8d1a fix: error when loading survey block without user in new runtime (#36226)
* fix: always define a student_data_store to prevent errors on XBlock load

* chore: bump xblock version to 5.1.2
2025-02-12 09:41:46 -08:00
Navin Karkera
2598084946 feat: upstream downstream link model [FC-0076] (#36111)
Adds models, tasks, signal handlers and api's for adding, updating and deleting upstream->downstream links in database.
2025-02-11 12:15:50 -05:00
Deborah Kaplan
1ced859b77 APER-3884: make sure links point to MFE not legacy (#36241)
now that the legacy profile and account pages have been removed, we need to make sure that all of the links point to the MFE URLs; we were relying on the legacy applications to do redirection before.

FIXES: APER-3884
FIXES: openedx/public-engineering#71
2025-02-11 11:18:11 -05:00
Deborah Kaplan
29de9b2dc4 feat!: Legacy account, profile, order history removal (#36219)
* feat!: Legacy account, profile, order history removal

This removes the legacy account and profile applications, and the order
history page. This is primarily a reapplication of #31893, which was
rolled back due to prior blockers.

FIXES: APER-3884
FIXES: openedx/public-engineering#71


Co-authored-by: Muhammad Abdullah Waheed <42172960+abdullahwaheed@users.noreply.github.com>
Co-authored-by: Bilal Qamar <59555732+BilalQamar95@users.noreply.github.com>
2025-02-10 14:39:13 -05:00
Daniel Valenzuela
36c16d6952 fix: static assets used in problem bank and library content block (#36173)
Static assets were not being copied into the course when using library content via Problem Bank or "Add Library Content" workflows.
2025-02-07 10:30:05 -08:00
Ahtisham Shahid
02d2d34a25 feat: added events in account level notification preferences (#36231) 2025-02-07 17:20:59 +05:00
Daniel Valenzuela
182bfc4031 feat: add publish status to library meilisearch index [FC-0076] (#36031)
Adds the publish status field to the libraries v2 meilisearch index in order to support filtering by component publish status: published, modified, never.
2025-02-05 17:30:19 +00:00
Jesper Hodge
1f43d17b21 Revert "Replace pkg_resources with importlib.resources" (#36208) 2025-02-05 08:51:50 -05:00
Kyle McCormick
32275662b0 feat!: A Better API for Derived Settings (#36192)
The Python API for declaring derived settings was confusing to the uninitiated
reader, and also prone to spelling mistakes. This replaces the API with one
that is more readable and more concise, and updates the implementation of
`derive_settings` to properly derive settings declared using the new API.

BREAKING CHANGE: The `derived` and `derived_collection_entry` function are
replaced with the `Derived` class. We do not expect those functions to have
been used outside of edx-platform, but if they are, this commit will cause them
to loudly ImportError.

Note that there should be NO change in behavior to the `derive_settings`
function, which we DO know to be used by some external edx-platform plugins.

Part of: https://github.com/openedx/edx-platform/issues/36215
2025-02-04 14:57:43 -05:00
Robert Raposa
c84af05251 docs: explain default session expiration (#36126) 2025-02-03 16:17:45 -05:00
Usama Sadiq
1a16073ad0 fix: enable pylint warnings (#36196) 2025-02-03 14:18:11 +05:00
Rômulo Penido
4f13ee0171 fix: advanced editor styling on library authoring [FC-0076] (#36146)
Fixes the styles for the advanced editors (poll, survey, LTI Provider, etc). Updated the code if `xblock_v2/xblock_iframe.html` to use `course-unit-mfe-iframe-bundle.scss`
2025-01-30 17:36:21 +00:00
Navin Karkera
5e51e2d5b7 fix: swagger docs ref_name conflicts (#36189)
* fix: swagger docs ref_name conflicts

* fix: swagger auto doc errors

* chore: bumps openedx-learning==0.18.2

---------

Co-authored-by: Jillian Vogel <jill@opencraft.com>
2025-01-30 20:32:18 +05:30
Usama Sadiq
b6828cecaa fix: enable pylint warnings (#36195)
* fix: enable pylint warnings
2025-01-30 17:15:33 +05:00
Kyle McCormick
98a4a32805 feat: Make dump for fns, classes more stable and helpful (#36188)
The `dump_settings` command currently prints out the raw `repr(...)`s for
defined functions, e.g.:

    "WIKI_CAN_ASSIGN": "<function CAN_ASSIGN at 0x74ce5e9b2020>",

In addition to being uninformative, these `at 0x74ce...` hashes change every
run, so they appear in the diff as having "changed" every time. With this
commit, here's what `dump_settings` will print out for a function instead:

    "WIKI_CAN_ASSIGN": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_ASSIGN"
    },
2025-01-29 11:05:57 -05:00
Deborah Kaplan
1fe67d3f6b feat: increase frequency of scheduled notify credentials (#36180)
`notify_credentials` has 2 ways of running.
1. The manual,  one-off method  which uses `--args_from_database`  to specify what should be sent.
2. [The automated method](7316111b35/openedx/core/djangoapps/credentials/management/commands/notify_credentials.py (L157-L159)), which runs on a regular schedule, to catch anything which fell through the cracks.

The automated method does a certain amount of time/date math in order to calculate the entry point of the window based on the current runtime.  This is, I assume, why it has some hardcoded logic; it's not at all simple to have a `cron`-run  management command running on a regular cadence that can do the same time logic.

```py
        if options['auto']:
            options['end_date'] = datetime.now().replace(minute=0, second=0, microsecond=0)
            options['start_date'] = options['end_date'] - timedelta(hours=4)
```

However, it is not ideal that the actual time window of 4 hours is hardcoded directly into `edx-platform`.

This fix

* creates an overridable `NOTIFY_CREDENTIALS_FREQUENCY` that defaults to 14400 seconds (4 hours).
* pulls that frequency into the quoted code

Using seconds allows maximum flexibility.

FIXES: APER-3383
2025-01-27 22:26:00 +00:00
Deborah Kaplan
8e1e55a0d7 chore: linting as a separate commit (#36179)
I'm letting autoformat hit this file to make it match our current
standards before I actually make any code changes.
2025-01-27 16:53:47 -05:00
Kyle McCormick
dc2a38b1f4 feat: dump_settings management command (#36162)
This command dumps the current Django settings to JSON for
debugging/diagnostics. The output of this command is for *humans*... it
is NOT suitable for consumption by production systems.

In particular, we are introducing this command as part of a series of
refactorings to the Django settings files lms/envs/* and cms/envs/*.
We want to ensure that these refactorings do not introduce any
unexpected breaking changes, so the dump_settings command will both help
us manually verify our refactorings and help operators verify that our
refactorings behave expectedly when using their custom python/yaml
settings files.

Related to: https://github.com/openedx/edx-platform/pull/36131
2025-01-27 15:29:29 -05:00
Usama Sadiq
2d7a3d3fbd fix: remove pylint constraint (#36169) 2025-01-27 21:25:42 +05:00
Marcos
747289bc1a fix: Removed JWT constants from CMS and added comments on how to generate them 2025-01-23 15:55:58 -03:00
Marcos
67a56c270f chore: Moved jwt file to openedx.core.lib 2025-01-23 15:55:58 -03:00
Feanil Patel
da0d365ee3 Merge pull request #36044 from openedx/pkg_resources-depr
Replace pkg_resources with importlib.resources
2025-01-23 11:05:45 -05:00
David Ormsbee
c762c1f695 perf: update edx-when to 2.5.1 for performance fix
This addresses an issue where get_schedule_for_user was making an
excessive number of calls to the database.
2025-01-22 10:50:04 -05:00
Chris Chávez
e930bc60b1 feat: Changes in xblock_v2 to support studio_view [FC-0076] (#36029)
Updates to support studio_view (editors) in xblock_v2 iframe.

- Send a message when cancel button is clicked on xblock_v2 iframe only in studio_view
- Send a message when save.end event is notified on xblock_v2 iframe.
- Send notify function in runtime. This is to avoid errors when saving the Xblock
2025-01-16 18:10:59 +00:00
Jillian
b96a3bf249 fix: allow_to_create_new_org checks org autocreate [FC-0076] (#36094)
Updates the StudioHome API's allow_to_create_new_org to require both organization-creation permissions and ORGANIZATION_AUTOCREATE to be enabled. It also adds the list of "allowed organizations for libraries" to the Studio Home API so that the Authoring MFE can use it.
2025-01-15 17:32:37 +00:00
jawad khan
e859d7e9d9 feat: Add course id in notifications list api for mobile Devices (#36106) 2025-01-15 14:12:34 +05:00
Navin Karkera
cd9b90fc21 feat: show math in plain text in library cards (#36055)
Converts mathjax equations to unicode to be rendered as plain text in library card previews
2025-01-13 13:09:47 -05:00
Muhammad Adeel Tajamul
f4c2b46671 chore: updated notification preference url in email digest (#36101) 2025-01-13 12:56:40 +05:00
Kyle D. McCormick
3dc28abcf7 build: Fix type annotations for new mypy version
Includes some new Request type annotations in openedx.core.types.http,
plus a new meta-utility @type_annotation_only to ensure that we don't
accidentally start instantiating those new classes.
2025-01-09 10:31:01 -05:00
Irtaza Akram
acdbff8b4c fix: remove pkg_resources 2025-01-08 16:45:19 +05:00
Kyle D. McCormick
d36560d8c6 refactor: UsageKeyV2Serializer should be a BaseSerializer
...not a Serializer, as it overrides to_representation to a str rather
than a dictionary.

This type error arose during the djangorestframework-stubs upgrade in
the previous commits.
2025-01-02 14:42:09 -05:00
Kyle D. McCormick
50944e9d75 build: Very explicitly annotate a model field so that it passes mypy
This clunky yet type-safe workaround to this django-stubs issue, which
arose when we upgraded django-stubs in the previous commits:
https://github.com/typeddjango/django-stubs/issues/1802
2025-01-02 14:42:09 -05:00
Kyle D. McCormick
2d5543a9ae feat!: Remove Paver
BREAKING CHANGE: Removes all remaining Paver commands including
`pavelib/prereqs.py:*` and `pavelib/assets.py:*`.

BREAKING CHANGE: Removes `./manage.py [lms|cms] compile_sass`, which
was just a wrapper around Paver commands.

BREAKING CHANGE: Removes paver.txt. Operators should install testing.txt
instead.

Part of: https://github.com/openedx/edx-platform/issues/34467
2025-01-02 14:05:15 -05:00
Eemaan Amir
645e8985c2 chore: added a new info log to course update email (#36067)
* chore: added a new info log to course update email

* chore: added a new info log to course update email
2025-01-01 17:05:56 +05:00
Ahtisham Shahid
ab6947fb77 fix: resolved key error in notification pref apis (#36064) 2025-01-01 15:45:26 +05:00
Muhammad Adeel Tajamul
b369345dc1 fix: fixed notification generated event for grouped notifications (#36065) 2025-01-01 14:17:44 +05:00
Daniel Valenzuela
85f412864f fix: render library v2 assets with whitespace (#35974)
Assets that contain whitespace fail to be rendered when uploaded to library v2
2024-12-24 13:51:03 +00:00