Commit Graph

6303 Commits

Author SHA1 Message Date
Jillian Vogel
7d81c3e671 test: minor fixes to requires_blockstore tests
These tests aren't run as part of the CI, and so have been failing for
an unknown time.
2022-04-21 09:39:59 +01:00
Jillian Vogel
cfd53aff70 refactor: installs blockstore into edx-platform
* adds blockstore as a requirement and an installed app, with
  configurable bundle storage settings.
* adds waffle switch and setting to allow use of blockstore's python API
  instead of REST API in live testservers and in production.
* adds database router which, when a `blockstore` DATABASE connection is
  configured, allows the platform to use the blockstore service's
  database instead of the default edxapp database.
* replaces blockstore_api exceptions and models with blockstore.app.api classes
* minor fixes to the blockstore_api to make the Blockstore REST API
  return data packaged the same as the Blockstore Python API.
2022-04-21 09:39:54 +01:00
Tim McCormack
a251d18281 feat!: Use more-trusted IP in rate-limiting (#241)
Previously, our rate-limiting code trusted the entire `X-Forwarded-For`
header, allowing a malicious client to spoof that header and evade
rate-limiting. This commit introduces a new module and setting
allowing us to make a more conservative choice of IPs.

- Create new `openedx.core.djangoapps.util.ip` module for producing
  the IP "external chain" for requests based on the XFF header and the
  REMOTE_ADDR.
- Include a function that gives the safest choice of IPs.
- Add new setting `CLOSEST_CLIENT_IP_FROM_HEADERS` for configuring how
  the external chain is derived (i.e. setting the trust
  boundary). Currently has a default, but we may want to make it
  mandatory in the future.
- Change `django-ratelimit` code to use the proximate IP in the external
  chain -- the one just outside the trust boundary.

Also:

- Change `XForwardedForMiddleware` to use more conservative choice for
  its `REMOTE_ADDR` override
- Other adjustments to `XForwardedForMiddleware` as needed in order to
  initialize new module and support code that needs the real
  `REMOTE_ADDR` value
- Metrics for observability into the change (and XFF composition)
- Feature switch to restore legacy mode if needed

This also gives us a path forward to removing use of the django-ipware
package, which is no longer maintained and has a handful of bugs that make it
difficult to use safely.

Internal ticket: ARCHBOM-2056
2022-04-20 13:46:58 +00:00
Michael Terry
bc10f653dc fix: remove a couple unused learning MFE serializer fields
Now that the frontend assumes there are no legacy courseware pages,
we can stop sending them info about it.
2022-04-19 15:06:37 -04:00
Michael Terry
afd19f0513 feat!: drop legacy courseware tab access for learners
The only way to access the legacy courseware is now through the
Studio preview feature (and at some point, when the MFE supports a
preview mode, we can then remove even that).

This drops the courseware.use_legacy_frontend waffle.
2022-04-19 12:27:10 -04:00
Muhammad Adeel Tajamul
40b2034717 Merge pull request #30253 from openedx/tnl-9871
feat: added flag to access course live in learning mfe
2022-04-18 10:45:14 +05:00
adeel.tajamul
f48cc56e04 feat: added flag to access course live in learning mfe 2022-04-15 16:22:15 +05:00
Michael Terry
ce5f1bb343 feat!: drop legacy course home view and related code
This was the "outline tab" view of the course. Preceded by the
course info view, succeeded by the MFE outline tab.

In addition to the course home view itself, this drops related
features:
- Legacy version of Course Goals (MFE has a newer implementation)
- Course home in-course search (MFE has no search)

The old course info view and course about views survive for now.

This also drops a few now-unused feature toggles:
- course_experience.latest_update
- course_experience.show_upgrade_msg_on_course_home
- course_experience.upgrade_deadline_message
- course_home.course_home_use_legacy_frontend

With this change, just the progress and courseware tabs are still
supported in legacy form, if you opt-in with waffle flags. The
outline and dates tabs are offered only by the MFE.

AA-798

(This is identical to previous commit be5c1a6, just reintroduced
now that the e2e tests have been fixed)
2022-04-14 15:18:31 -04:00
Michael Terry
a515c2e992 Revert "Drop legacy outline tab in favor of the MFE's version" 2022-04-14 14:16:29 -04:00
Michael Terry
be5c1a64d5 feat!: drop legacy course home view and related code
This was the "outline tab" view of the course. Preceded by the
course info view, succeeded by the MFE outline tab.

In addition to the course home view itself, this drops related
features:
- Legacy version of Course Goals (MFE has a newer implementation)
- Course home in-course search (MFE has no search)

The old course info view and course about views survive for now.

This also drops a few now-unused feature toggles:
- course_experience.latest_update
- course_experience.show_upgrade_msg_on_course_home
- course_experience.upgrade_deadline_message
- course_home.course_home_use_legacy_frontend

With this change, just the progress and courseware tabs are still
supported in legacy form, if you opt-in with waffle flags. The
outline and dates tabs are offered only by the MFE.

AA-798
2022-04-14 09:12:01 -04:00
Demid
16fa97dde4 feat: deprecate filestore
This:

1. Removes the `filestore` property from the `ModuleSystem` in favor of
   the `runtime.resources_fs` property.
   In the original code, `filestore` is equal to
   `DescriptorSystem.runtime.resources_fs`. It's safe to replace it with
   `ModuleSystem.runtime.resources_fs` because both runtimes are combined
   using the `CachingDescriptorSystem`. It provides the `resources_fs` property
   that uses the same file storage.

2. Renames `filestore` argument to `resources_fs` in the `LoncapaSystem`
   constructor.

3. Adds the deprecated `filestore` property to the `ModuleSystemShim`
   and `RuntimeShim`.
2022-04-14 14:45:05 +02:00
Kshitij Sobti
1ea90d8843 fix!: supply the editor and closing user as separate params to cs_comments_service (#30230)
The forum service doesn't get the requesting user id for any operation, only the user id of the content creator. So to apply a different user id for an editor or post closing user, those need to be explicitly passed.
2022-04-14 16:21:55 +05:00
Hamza Khchine
ea8f667bee feat: Add management command for updating discussion user stats for all users in a course (#29973)
Adds a management command to trigger an update to generate user stats for all users in a course.
2022-04-13 19:09:50 +05:00
SaadYousaf
149ca028d7 feat: update discussion settings API to handle changes reported_content_email_notification field 2022-04-13 15:10:48 +05:00
Abdurrahman Asad
4ad1dfcd5d feat: add API to return course live iframe (#30179)
feat: add API to return course live iframe
2022-04-11 23:20:41 +05:00
Usama Sadiq
80f9f1de7a Fix quality failures with pylint 2.13.5 (#30197)
* build: update pylint-checks ci workflow
* fix: fix quality failures with new pylint version
* chore: remove pylint constraint
* chore: Updating Python Requirements (#30196)
Co-authored-by: edX requirements bot <49161187+edx-requirements-bot@users.noreply.github.com>
2022-04-07 13:59:44 +05:00
Muhammad Adeel Tajamul
dd1de0cf72 fix: config_on_db if live is already enabled (#30188)
Co-authored-by: adeel.tajamul <adeel.tajamul@arbisoft.com>
2022-04-06 14:24:45 +05:00
SaadYousaf
098f1223f4 docs: ADR for reported content email notification for moderators 2022-04-06 12:24:53 +05:00
SaadYousaf
d852fecf06 feat: add reported_content_email_notifications field for CourseDiscussionSettings model 2022-04-06 12:02:40 +05:00
Ahtisham Shahid
e8e766e9e2 fix: Added default config_store while creating new empty settings (#30180) 2022-04-05 15:38:07 +05:00
Zainab Amir
921dadac99 feat: add password compliance check for login (#30149)
Add nudge and block checks for HIBP API on login view

VAN-667
VAN-668
2022-04-05 11:18:52 +05:00
Muhammad Adeel Tajamul
38bad82cea Merge pull request #30169 from openedx/tnl-9787
fix: adding empty live configuration
2022-04-04 17:27:11 +05:00
adeel.tajamul
3d24827973 fix: adding empty live configuration 2022-04-04 16:50:24 +05:00
Hammad Ahmad Waqas
c6e7bbcdf4 Merge pull request #30150 from openedx/hammad/ENT-5524
feat: added management command to fire segments events to suggest courses from programs.
2022-04-04 15:52:01 +05:00
Ahtisham Shahid
07f6a9fecc feat: added unit tests for course live tab (#30115)
feat: added unit tests for course live tab
2022-04-04 14:47:13 +05:00
HammadAhmadWaqas
172910d257 feat: added management command to fire segments events to suggest courses from programs. 2022-04-04 14:46:42 +05:00
Saad Yousaf
fd60d8c8cf fix: revert discussion xblock from MFE view to legacy view. (#30141)
Co-authored-by: SaadYousaf <saadyousaf@A006-00314.local>
2022-03-30 11:31:45 +05:00
Kyle McCormick
8039e40f47 refactor: move coursegraph to cms
This code was originally located at:
  ./openedx/core/djangoapps/coursegraph

However, code makes more sense within the ./cms tree, because:
* it is responsible for publishing course content to an
  external system, with is within the responsibilities of CMS, and
* is uses modulestore, which is discouraged for use in LMS
  (see 0011-limit-modulestore-use-in-lms.rst).

So, we move the code to:
  ./cms/djangoapps/coursegraph
and uninstall coursegraph from LMS.

We do not expect this refactor to have any breaking downstream effects.
2022-03-29 11:21:20 -04:00
Julia Eskew
edd7e0a77d feat: Combine the two existing log messages for submitting courses to Neo4j for
viewing in coursegraph for two reasons. First, the existing log message was misleading
as it implied that a course was being submitted to Neo4j even when it was being
skipped due to not changing since last being sent to Neo4j. Second, the new log
message was not distinctive enough for separate searching in Splunk - it will
now be distinctive enough for that search.
2022-03-28 13:27:40 -04:00
pkulkark
557f58c341 fix: Convert password compliance warning to html 2022-03-26 15:13:03 +05:30
Awais Qureshi
bc45f1ee48 fix: Removed usage of djangoratelimitbackend. (#30116)
* fix: Removed usage of djangoratelimitbackend.
2022-03-25 15:27:39 +05:00
Shafqat Farhan
935c01c9ee Merge pull request #30122 from openedx/shafqat/VAN-669
feat: VAN-669 - Disallow bad passwords on Registration
2022-03-25 15:18:36 +05:00
Shafqat Farhan
df22dfbe0d feat: VAN-669 - Disallow bad passwords on Registration 2022-03-25 15:00:07 +05:00
Matjaz Gregoric
8633249853 Merge pull request #28268 from open-craft/agrendalath/bb-4503_library_content_block_completion
feat: allow marking Library Content Block as complete on view [BB-4503]
2022-03-25 08:27:13 +01:00
Usama Sadiq
1cebd3ed7b Remove django-ratelimit-backend (#30054)
* fix: remove the usage of django-ratelimit-backend

Co-authored-by: Awais Qureshi <awais.qureshi@arbisoft.com>
2022-03-24 17:21:56 +05:00
Agrendalath
d05e5c639f feat: allow marking Library Content Block as complete on view
edx/edx-platform#24365 has changed the completion mode of these blocks.
Before Koa, it was sufficient to view the block to get a completion checkmark.
Since Koa, all children of the block must be completed.

This adds a toggle to change the completion behavior back to the previous one
so that the user experience can be consistent if needed.
2022-03-22 19:09:50 +01:00
Tim McCormack
813b403575 fix: Use more accurate attr name for IP chain size (#30106)
XFF is just part of the chain; record the length of the whole chain instead
(which is always one larger).

Also include junk in one of the test values for realism.
2022-03-22 15:33:35 +00:00
Julia Eskew
9b59b5e92a feat: Add detailed logging messages about each course updated in Neo4j (coursegraph).
TNL owns coursegraph and we've seen 7000+ courses be submitted for update weekly.
While log message exist for each course not submitted, no log message currently exists
for each submitted course. This commit adds logs for those submitted courses as well.
2022-03-22 10:20:59 -04:00
Chris Deery
e8462bb667 feat: [AA-1207] remove redundant Tabs fields from courseware API (#30079)
feat: [AA-1207] remove redundant Tabs fields from courseware API

Remove redundant fields from courseware API.

- number
- verified_mode
- original_User_is_staff
- is_staff

This is the backend work for https://github.com/openedx/frontend-app-learning/pull/873
2022-03-18 12:09:52 -04:00
Tim McCormack
c3bc68abc1 feat: Add monitoring for X-Forwarded-For header length (#30090) 2022-03-18 15:31:27 +00:00
Robert Raposa
c51a0c3e22 Merge pull request #30081 from openedx/robrap/ARCHBOM-2054-move-cookie-monitoring-middleware
refactor: CookieMonitoringMiddleware moved to edx-django-utils
2022-03-18 09:07:50 -04:00
Robert Raposa
776c3ab9c0 docs: warn about test order issue
Some registration tests can fail if run in a
particular order. This PR just adds a warning
so engineers don't mistakenly think they caused
an issue.

Also see VAN-900 for more details on how to
reproduce.
2022-03-17 16:59:00 -04:00
Robert Raposa
9fa79809d8 refactor: CookieMonitoringMiddleware moved to edx-django-utils
The CookieMonitoringMiddleware and its related script
moved to edx-django-utils.

ARCHBOM-2054
2022-03-17 16:59:00 -04:00
Ahtisham Shahid
7e90306ffe Ahtisham/fixed urls course live (#30083)
* fix: removed traling / to avoid confusion
2022-03-17 14:06:51 +05:00
Ahtisham Shahid
5adceaa547 refactor: resolved doc issues and expected response (#30076)
* refactor: resolved doc issues and expected response
2022-03-17 12:11:03 +05:00
Felipe Trzaskowski
6bfb741c4a feat: add edit_reason_code and close_reason_code (#29609)
Add `edit_reason_code` field to both `Comments` and `Threads`, making it
editable for anyone who can also edit `raw_body`.

Add `close_reason_code` field to `Threads`, and make it editable by
anyone who can also edit `closed`.
2022-03-16 17:02:47 +05:00
Ahtisham Shahid
97edc47129 feat: added live lti course tab (#30035)
* feat: added live lti course tab

* fix: resolved test errors

* feat: Moved live tab behind the waffle flag
2022-03-16 11:46:49 +05:00
Robert Raposa
23a5f9500e fix: process cookie headers at request time (#30068)
Processing cookies at response time included cookies
that were temporary, like the JWT cookie that is
created by the server by combining the JWT header-payload
and JWT signature cookies. Since we are trying to monitor
the cookie header, we do not want to process this cookie.

However, since we want to include the user id in the logging
message, we delay the logging until response time.

Also, fixed docstring which mislabeled a custom attribute.

ARCHBOM-2055
2022-03-15 15:45:21 -04:00
Kaustav Banerjee
c48c655998 refactor: deprecates replace url related properties from ModuleSystem
Deprecates the following attributes from ModuleSystem:
 * replace_urls
 * replace_course_urls
 * replace_jump_to_id_urls

A new ReplaceURLService is created as replacement with a unified replace_urls method
2022-03-14 09:35:41 -04:00
Dillon Dumesnil
d43ece5dba feat: AA-1205: Add Learning MFE support for Entrance Exams
* Adds entrance exam information to the Course Overview object
    * Enables hiding other tabs since the get_course_tab_list uses
      a Course Overview
    * Enables using the entrance exam helper functions to determine
      if Entrance exams are being used in this course.
* Posts a message when Entrance Exam is passed to parent container for
usage in the Learning MFE
* Overrides the 'title' field of the courseware tab since the Learning MFE
uses that over the 'name' field.
2022-03-14 09:04:45 -04:00