Commit Graph

5933 Commits

Author SHA1 Message Date
Feanil Patel
6ea123db4d Merge pull request #34528 from openedx/feanil/remove_django_splash
feat!: Remove the django-splash app.
2024-04-19 10:53:46 -04:00
Feanil Patel
6ea63da969 fix: Don't use the deprecated location for Hashable
The Hashable object was moved in python 3.3 and support for the old
location is dropped in python 3.10 the new location is available in
python 3.8 so we can just update this and it should work with both
python 3.8 and 3.11

https://docs.python.org/3.8/library/collections.html
2024-04-18 13:28:30 -04:00
Feanil Patel
b20ac9c515 fix: Be able to clear the process_cache manually in Python 3.11
Given code like the following

```
class Foo:
    @process_cached
    def bar(self):
        pass
```

In Python 3.8 referencing `bar` would not call its `__get__` method.

```
x = Foo().bar
```

However in Python 3.11, making the same call would call the `__get__`
method, permanently replacing the underlying `process_cached` object
with the partial function that references it.

This meant that code to clear the cache would work in Python 3.8 but
would break in 3.11

```
Foo().bar.cache.clear()  # Works in 3.8 but not in 3.11
```

In 3.11 this results in the following error:
```
E       AttributeError: 'functools.partial' object has no attribute 'cache'
```

To make this compatible in both version, we just add the cache as an
accessible attribute on the partial we generate for our wrapped
function.
2024-04-18 13:28:30 -04:00
connorhaugh
f866545bb9 temp: trace celery tasks in dd (#34537) 2024-04-18 13:08:25 -04:00
Rômulo Penido
90b253a38a feat: update Studio search index when course content is updated (#34391) 2024-04-18 09:53:21 -07:00
Feanil Patel
9bd4474f7d test: Reduce query counts now that we dropped django-splash. 2024-04-18 12:43:33 -04:00
Jillian
d67211051b feat: restrict Studio search results based on user permissions (#34471)
* feat: adds SearchAccess model

Stores a numeric ID for each course + library, which will generally be
shorter than the full context_key, so we can pack more of them into the
the Meilisearch search filter.

Also:

* Adds data migration pre-populates the SearchAccess model from the existing
  CourseOverview and ContentLibrary records
* Adds signal handlers to add/remove SearchAccess entries when content
  is created or deleted.
* Adds get_access_ids_for_request() helper method for use in views.
* Adds tests.

* test: can't import content.search in lms tests

* feat: use SearchAccess in documents and views

* Adds an access_id field to the document, which stores the
  SearchAccess.id for the block's context.
* Use the requesting user's allowed access_ids to filter search results
  to documents with those access_ids.
* Since some users have a lot of individual access granted, limit the
  number of access_ids in the filter to a large number (1_000)
* Updates tests to demonstrate.

* test: can't import content.search or content_staging in lms tests

* fix: make access_id field filterable

* fix: use SearchAccess.get_or_create in signal handlers

In theory, we shouldn't have to do this, because the CREATE and DELETE
events should keep the SearchAccess table up-to-date.

But in practice, signals can be missed (or in tests, they may be
disabled). So we assume that it's ok to re-use a SearchAccess.id created
for a given course or library context_key.

* refactor: refactors the view tests to make them clearer

Uses helper methods and decorators to wrap the settings and patches used
by multiple view tests.

* feat: adds org filters to meilisearch filter

* Uses content_tagging.rules.get_user_orgs to fetch the user's
  content-related orgs for use in the meilisearch filter.
* Limits the number of orgs used to 1_000 to keep token size down

* refactor: removes data migration

Users should use the reindex_studio management command to populate SearchAccess.

* refactor: adds functions to common.djangoapps.student.role_helpers

to allow general access to the user's RoleCache without having to access
private attributes of User or RoleCache.

Related changes:

* Moves some functionality from openedx.core.djangoapps.enrollments.data.get_user_roles
  to this new helper method.
* Use these new helper method in content_tagging.rules

* fix: get_access_ids_for_request only returns individual access

instead of all course keys that the user can read.

Org- and GlobalStaff access checks will handle the rest.

* fix: use org-level permissions when generating search filter

Also refactors tests to demonstrate this change for OrgStaff and
OrgInstructor users.

* refactor: remove SearchAccess creation signal handlers

Lets SearchAccess entries be created on demand during search indexing.

* feat: omit access_ids from the search filter that are covered by the user's org roles

---------

Co-authored-by: Rômulo Penido <romulo.penido@gmail.com>
2024-04-17 11:21:34 -07:00
Saad Yousaf
6dd5157fee fix: fix cadence value for instant cadence and update version 2024-04-17 14:16:50 +05:00
Saad Yousaf
0270809808 feat: add email cadence setting in notification preferences for emails 2024-04-15 17:04:56 +05:00
Kyle D. McCormick
5fe131c858 fix: --theme-dirs argument to compile_sass management command
This fixes the ability to pass custom theme directories to
the management command which compiles site themes, a la:

   ./manage.py lms compile_sass --theme-dirs /my/custom/themes/dir

The exception, which was due to a incompatible use of @lru_cache, was:

   File "openedx/core/djangoapps/theming/management/commands/compile_sass.py",
   line 93, in parse_arguments:
     available_themes.update({t.theme_dir_name: t for t in get_themes([theme_dir])})
   TypeError: unhashable type: 'list'

This has been broken since the @lru_cache decorator was added, but it
wasn't noticed because:

* We weren't compiling any comprehensive themes in CI.
* Tutor supports compehensive theming, but not *site theming*, so
  it doesn't use this management command at all
  (site themeing == comp theming * site configuration).
* Although edx.org executes this management command, it does not provide
  use the `--theme-dirs` argument, so the bug was not hit.
2024-04-12 11:33:31 -04:00
Taras Lytvynenko
14777af1d2 Lytvynenko/changed link parsing (#33565)
* fix:  Social link parsing approach changed

* feat: fix tests

* fix: tests

---------

Co-authored-by: Edward Zarecor <ezarecor@tcril.org>
2024-04-10 17:38:57 -04:00
Chris Chávez
ddb407a3f2 feat: handle tags when importing/exporting courses (#34356) 2024-04-08 11:39:46 -07:00
Ben Lu
54eeedf3a4 Merge pull request #34400 from openedx/add-JWT-kid-for-verification-when-use-asymmetric-key
feat: add kid when encoding and signing JWT with asymmetric key
2024-04-08 12:53:49 -05:00
Irtaza Akram
a1f08d85bd Merge pull request #34398 from openedx/xblock2
upgrade xblock==2.0
References:
- https://github.com/openedx/public-engineering/issues/15
- https://github.com/openedx/XBlock/pull/680
2024-04-08 14:30:38 +05:00
Kyle D. McCormick
24db4dfb53 build: compile/watch sass with new npm scripts
`paver` commands are deprecated for managing static assets. Starting in
Sumac, only `npm run` commands will be supported for managing static
assets.

To ease the transition, both `paver` and `npm run` commands will work in
Redwood. However, we want to stop using the *implementations* of the
`paver` asset commands right now, as they are blocking the Python 3.11
upgrade. This will also make the removal of `paver` commands more
straightforward come Sumac.

So, this commit turns these commands/functions:
* paver compile_sass (used by configuration)
* paver watch_sass (used by configuration and devstack)
* pavelib/assets.py:_compile_sass (used by Tutor)

into very thin wrappers around the new `npm run` commands. Each of these
paver routines now raise a loud deprecation warning, including a message
of the `npm run` command that the operator can switch to.
We expect no impact to site operators or end users.

https://github.com/openedx/edx-platform/issues/31895
2024-04-04 10:31:02 -04:00
Muhammad Adeel Tajamul
fe13884ed6 feat: added management command to delete notifications (#34447)
* feat: added management command to delete notifications
2024-04-04 16:57:26 +05:00
Dmytro
03a490f7cd feat: add ability to notify credentials about honor certificates (#32633) 2024-04-04 07:56:02 -04:00
Ben Lu
6112f85c0b fixup! feat: add JWT KID 2024-04-03 13:22:51 -05:00
Ben Lu
ef59da6775 feat: add JWT KID
Added JWT KID when encoding and signing JWT with asymmetrical key
2024-04-03 12:13:53 -05:00
Irtaza Akram
79a4327f67 Merge branch 'master' into xblock2 2024-04-03 14:57:00 +05:00
Jillian
7ad225658f feat: don't use OLX for tags when copying/duplicating blocks (#34386) 2024-04-02 09:59:57 -07:00
Irtaza Akram
3faa773bb9 feat: add support for xblock 2 2024-04-01 16:02:06 +05:00
Syed Sajjad Hussain Shah
4d4f8f457d Revert "chore: moved user_authn all urls in urls.py (#34396)" (#34431)
This reverts commit fc63719ceb.
2024-03-27 11:33:38 +05:00
Justin Hynes
7f62080c95 refactor: update logs, remove direct use of CredentialsApiConfig model (#34393)
[APER-3229]

In a previous PR, I created a new utility function named `is_credentials_enabled()` that can be used to determine if use of the Credentials IDA is enabled by config in an Open edX instance.

This PR is some additional cleanup that replaces the direct import and use of the `CredentialsApiConfig` model with the new utility function.

I took some additional time to update some existing log messages to include more info while reducing our need to log PII. I've removed as much use of a learner's username as possible, replacing it with logging the learner's LMS User Id instead.
2024-03-26 08:29:11 -04:00
Syed Sajjad Hussain Shah
fc63719ceb chore: moved user_authn all urls in urls.py (#34396) 2024-03-25 22:05:55 +05:00
Braden MacDonald
f663739510 feat: Index Studio content using Meilisearch [experimental] (#34310) 2024-03-22 10:08:31 -07:00
Dmytro
d19bd263c4 fix: email templates caching (#32627) 2024-03-21 09:37:44 -04:00
Maria Grimaldi
45178e0ced feat: add paginated HomePageCoursesV2 view with filtering & ordering (#34173) 2024-03-20 11:31:59 -04:00
Nathan Sprenkle
8571eeca61 feat: add course language to courseware API (#34392) 2024-03-20 11:02:41 -04:00
Ahtisham Shahid
c344fdc698 feat: added channels column to send notification on specific channels (#34289)
* feat: added channels column to send notifications on specific channels
2024-03-20 13:17:45 +05:00
Ehmad Saeed⚡
57970bd0e0 Merge pull request #34300 from openedx/asaeed/add-application-scopes-to-default-scopes
feat: add user_id in the default scopes if no scopes are requested from payload
2024-03-19 14:46:28 +05:00
Muhammad Adeel Tajamul
692965af4d feat: added edx-ace template and message type for email notifications (#34315) 2024-03-19 13:55:28 +05:00
Zia Fazal
1556be5851 feat: Add EnrollmentsService in XBlockRuntime and block renderer (#34238)
* feat: Add EnrollmentsService in XBlockRuntime and block renderer

These changes give ability to use `EnrollmentsService` in XBlocks
Add `get_active_enrollments_by_course_and_user` method to `EnrollmentsService` which can be used to get active enrollment of user for a give course
2024-03-19 09:41:11 +05:00
Justin Hynes
8d7a13f358 feat: update task and signals responsible for cert available dates in Credentials
[APER-3229]

The monolith and the Credentials IDA keep independent records of a course runs certificate availability/visibility preferences. This PR aims to improve the communication between the monolith and the Credentiala IDA to keep the availability date/preference in sync with the monoliths records.

The current code is too strict and actually prevents valid updates in some configurations.

Additionally, the Credentials IDA doesn't understand the concept of "course pacing" (instructor-paced vs self-paced) and has troubles with courses with an availability date of "end". Instead of having to add the concept of course pacing (and syncing more data between the two systems), this PR proposes sending the end date of a course as the "certificate available date" to Credentials.

This way, the Credentials IDA can manage the visibility of awarded credentials in a course run with a display behavior of "end" using the existing feature set and models of the Credentials service.
2024-03-18 12:30:40 +00:00
Ehmad Saeed
de6047184f fix: add toggle_target_removal_date annotation 2024-03-16 02:47:48 +05:00
Ehmad Saeed
c48fbb9b48 fix: toggle_use_cases and public ticket for its removal 2024-03-16 02:31:56 +05:00
Ehmad Saeed
fe1fcc2b7d fix: toggle annotations for ENABLE_USER_ID_SCOPE 2024-03-16 02:07:12 +05:00
Ehmad Saeed
070582aed6 docs: add ENABLE_USER_ID_SCOPE feature flag documentation 2024-03-16 01:39:28 +05:00
Ehmad Saeed
f07f8f220f fix: quality check for trailing whitespace 2024-03-16 01:05:43 +05:00
Ehmad Saeed
5be6ed6d66 fix: update ADRs and add test cases with ENABLE_USER_ID_SCOPE flag off 2024-03-16 00:54:08 +05:00
Ehmad Saeed
2694f82654 fix: copy default scopes to prevent mutating the original list 2024-03-15 03:29:15 +05:00
Ehmad Saeed
14199e5b99 chore: use feature-flag, remove mocks for tests and add ADR in decisions 2024-03-15 02:16:43 +05:00
Ehmad Saeed
51de2c6197 feat: add user_id in the default scopes 2024-03-12 22:58:11 +05:00
Rômulo Penido
cb6801dbfd feat: paste tags when pasting xblocks with tag data (#34270) 2024-03-08 12:03:43 -08:00
Kshitij Sobti
c3c0adf978 feat: add support for zip files to course and library import code (#34191)
Co-authored-by: Rodrigo Ferreira de Souza <rodfersou@gmail.com>
2024-03-08 18:51:35 +01:00
Rômulo Penido
42418fb3a0 feat: export tagged content library as CSV (#34246) 2024-03-04 11:35:19 -08:00
Blue
e11474db6b fix: add country field error message (#34316)
Description: Add country field error message in api response
VAN-1862
2024-03-01 12:09:51 +05:00
Mubbshar Anwar
b6d89bcd59 fix: fir segment event (#34279)
fire segment event for PWNED_PASSWORD on registration page password validation

VAN-1830
2024-03-01 10:22:57 +05:00
ayesha waris
c913a55b17 feat: updated api to get all question type reponses (#34215)
* feat: updated api to get all question type reponses

* test: fixed and added new test cases
2024-02-29 11:58:07 +05:00
Ehmad Saeed
4a8cc1e77e feat: add application scopes into default 2024-02-27 16:36:08 +05:00