Commit Graph

7419 Commits

Author SHA1 Message Date
Awais Qureshi
5b8cc00964 test: Fixed test failures due to randomization. (#29822)
* test: Fixed test failures due to randomization.
2022-01-26 19:48:55 +05:00
Usama Sadiq
59a0acc768 Revert "feat!: Remove django-admin default login. (#29416)" (#29824)
This reverts commit be2a57902f.
2022-01-26 19:17:45 +05:00
Awais Qureshi
be2a57902f feat!: Remove django-admin default login. (#29416)
Now redirect the admin-login towards the lms login.
BOM-2855
2022-01-26 17:27:17 +05:00
Attiya Ishaque
60f3623066 fix: [VAN-823] Remove Authn MFE Waffle Flag (#29778) 2022-01-26 16:02:53 +05:00
Michael Terry
299cd981e5 feat: enable using learning sequence outlines by default
This drops the learning_sequences.use_for_outlines waffle flag,
enabling using learning sequence outlines unconditionally.

(Note that Learning sequences still don't support legacy keys.)

AA-1040
2022-01-25 12:40:29 -05:00
Tim McCormack
ddc55483da Merge pull request #29768 from openedx/timmc/strict-by-default
feat: Enable ENFORCE_SAFE_SESSIONS by default
2022-01-25 17:19:11 +00:00
Awais Qureshi
c66498db36 test: Fixed test failures due to randomization. (#29816)
* test: Fixed test failures due to randomization.
2022-01-25 22:13:57 +05:00
Tim McCormack
9827a077aa feat: Enable ENFORCE_SAFE_SESSIONS by default; improve docs
This toggle has been shown to work, so enable by default. Will need to be
documented in release notes for deployers.
2022-01-25 16:03:54 +00:00
Tim McCormack
4624bb7c3e fix: Prevent SafeSessions false alarm in course outline alt-masquerading
The course outline view has a way for a staff user to make a request as if
they are another user, not just by using the masquerade mechanism but also
by setting a request parameter. This can result in false positives in the
safe-sessions middleware, and if `ENFORCE_SAFE_SESSIONS` is enabled the
responses will be 401 errors.

The fix here is to do the same thing that masquerading does in setting a
`real_user` property on the new user object, which the safe-sessions
middleware then undoes (restoring the request.user) before determing
whether there's a mismatch.

(Without this fix, enabling `ENFORCE_SAFE_SESSIONS` also causes some tests
in `test_views.py` to fail.)
2022-01-25 16:03:54 +00:00
Tim McCormack
e6536d0d0e test: Stop sharing API client between users in unit tests
Using the same Client or APIClient instance for multiple users, where
one user has an active session and the other is making an
Authorization header call, results in a Safe Sessions violation.

By using separate clients for different test users, we avoid this
violation, allowing `ENFORCE_SAFE_SESSIONS` to be enabled by default.
2022-01-25 16:03:54 +00:00
Tim McCormack
7fc20e69f4 feat: Allow safe-session exemption even for exceptions
Change `mark_user_change_as_expected` to no longer take the response object
and instead convey the expected-change information via RequestCache.
This requires edx-django-utils 4.4.2, which fixes the bug where
RequestCache was cleared in the exception phase.

Also, no longer mark `ENFORCE_SAFE_SESSIONS` toggle as
temporary. We'll want it as an opt-out.

I was tempted to take this opportunity to move any existing
`mark_user_change_as_expected` calls to be closer to where the actual
change request.user occurs, reducing risk of both false positives and false
negatives, but it would be better to do that one at a time in case a move
breaks something. (Ideally it would be called right after any
`django.contrib.auth` `login` or `logout` call; previously, we were
constrained by having to make the call after a response object had been
created.) These changes can be made later if it becomes necessary.
2022-01-25 16:03:54 +00:00
Dillon Dumesnil
a3c65012af Merge pull request #29818 from openedx/ddumesnil/fix-discount-override-aa-1191
fix: Include course key when checking enabled for COURSEWARE_MFE_MILE…
2022-01-25 06:44:48 -08:00
Dillon Dumesnil
e05122a437 fix: Include course key when checking enabled for COURSEWARE_MFE_MILESTONES_STREAK_DISCOUNT
AA-1191
2022-01-25 09:21:10 -05:00
Jillian Vogel
2173a98ef8 refactor: deprecates ModuleSystem properties for code sandboxing and cache
* Deprecates ModuleSystem can_execute_unsafe_code, get_python_lib_zip and cache properties
* Adds a new CacheService and SandboxService to provide the deprecated property
* Adds tests for the added CacheService and SandboxService
* Updates the ModuleSystemShim tests in Lms and Studio
2022-01-25 14:42:39 +10:30
Michael Terry
44e799f60d fix: don't show broken enroll link for staff on invite courses
Non-enrolled staff users were being shown enroll links for courses
that you can't self-enroll for (masters-only, invitation-only, etc).

This fixes the outline page to ignore staff status for that check.

AA-1164
2022-01-24 16:14:14 -05:00
Awais Ansari
62b7db64bc chore: update lti providers video link (#29802) 2022-01-21 20:00:24 +05:00
Ahtisham Shahid
e63fb2e01a feat: Created API for programs live page zoom lti (#29763)
* feat: Created API for programs live page zoom lti

* refactor: Merged similar code by inheritance

* refactor: removed duplicates and resolved tight coupling issues

* refactor: Decoupled views
2022-01-21 12:26:47 +05:00
Jillian Vogel
ef8f841ac2 temp: let XBlock API users optionally use LabXchange block types
when fetching block metadata and rendering blocks while maintaining the
original usage IDs/OLX.

This change is marked temporary because LabXchange need it during the
transition to a custom runtime, but it's not really useful to anyone
else. We will revert this change with a future PR.
2022-01-20 10:35:59 +10:30
Bianca Severino
e848935000 fix: exclude masters from honor code check 2022-01-19 15:11:41 -05:00
Sarina Canelake
bebe1e9a6b Merge pull request #29775 from jramnai/fix-coursegraph-readme
docs: nit for CourseGraph README file
2022-01-19 13:12:19 -05:00
Long Lin
9514cb5732 feat: add enterprise course enrollments data to enrollments for support 2022-01-19 10:14:13 -05:00
Kshitij Sobti
d5c9d61a98 feat: Allow fetching details of inactive providers (#29511) 2022-01-19 11:18:16 +05:00
Dillon Dumesnil
e458c7eb36 Merge pull request #29747 from openedx/ddumesnil/goal-celly-modal-aa-1138
feat: AA-1138: Adds ability to have Weekly Goal Celebration Modal in MFE

Adds celebrate_weekly_goal to the CourseEnrollmentCelebration and includes logic
for only returning True if the db field is true and the learner has hit their goal
this week. Adds ability to set to false via the API already used by the frontend.
Default db value is False, but all new enrollments after merge will be set to True.
2022-01-18 06:13:43 -08:00
Kshitij Sobti
2bbf447ab5 feat: banner for staff users that displays a message for testing the new MFE experience (#29698)
Adds a new banner allowing staff users to preview and switch between the new and legacy forum experience.
2022-01-18 11:18:59 +05:00
Jayram Nai
d942c91b01 docs: nit for coursegraph README file 2022-01-17 19:41:11 +05:30
Attiya Ishaque
bf46daa494 Merge pull request #236 from edx/attiya/VAN-817
fix: Add security fix in LMS logout redirect_url.
2022-01-17 14:27:01 +05:00
Dillon Dumesnil
7b1fead04c feat: AA-1138: Adds ability to have Weekly Goal Celebration Modal in MFE
Adds celebrate_weekly_goal to the CourseEnrollmentCelebration and includes logic
for only returning True if the db field is true and the learner has hit their goal
this week. Adds ability to set to false via the API already used by the frontend.
Default db value is False, but all new enrollments after merge will be set to True.
2022-01-14 13:59:22 -05:00
Chris Deery
dddcadb706 feat: [AA-922] remove deprecated Goals backend (#29705)
* feat: [AA-922] remove deprecated Goals backend

While the new Weekly Learning Goals were being rolled out, the previous goal setting feature still existed behind a waffle flag.
The Weekly Learning Goals now become the one and only learning goal feature.

This change does not remove the old goals feature from the legacy backend, and therefore it does not remove any of the data that was used by the old goals feature.
The goals are now driven by the single pre-existing Waffle flag ENABLE_COURSE_GOALS

 - Removed COURSE_GOALS_NUMBER_OF_DAYS_GOALS waffle flag, replacing it where needed with the existing ENABLE_COURSE_GOALS

 - modified the API to remove the old goal_options, keeping the redundant weekly_learning_goal_enabled flag

 - updated tests

 - refactor tests to fit 50 line limit in lint
2022-01-11 09:02:03 -05:00
AliAkbar
2989341b7c fix: add integer check for lms_user_id 2022-01-11 11:30:35 +05:00
Rebecca Graber
0e9499de7d feat: log an encrypted string of the full cookie header when over threshold (#29735)
* feat: log an encrypted string of the full cookie header when over threshold
2022-01-10 13:02:47 -05:00
Robert Raposa
5d79972260 fix: safe session bug when request has no user (#29731)
* fix: safe session bug when request has no user

Fixes a bug during safe session monitoring when
request has no user.

ARCHBOM-1940

* fixup! add comment and loosen if condition
2022-01-07 19:19:59 -05:00
Waheed Ahmed
fa7ef8661b fix: login by email (#29727) 2022-01-07 13:07:05 +05:00
Waheed Ahmed
ed45aee9dd refactor: separate user lookup queries for login (#29711)
Using a single query to get a user using both username and email fields
generates a massive `key_len` and causes DB overload. Separated these
lookups into two separate queries.
VAN-819
2022-01-07 11:06:07 +05:00
Robert Raposa
8fa1d4d0b6 fix: conditionally set safe session monitoring (#29724)
Fixes a bug where a custom attribute was being set
even for cases where we did not have the appropriate
data, and an exception was being raised.

ARCHBOM-1940
2022-01-06 16:49:58 -05:00
Robert Raposa
973fb3c4c6 fix: enhance safe session setting documentation (#29723)
Adds note to documentation around the requirement
for setting SAFE_SESSIONS_DEBUG_PUBLIC_KEY to log
encrypted headers.

ARCHBOM-1940
2022-01-06 13:44:53 -05:00
Robert Raposa
d0259ff38e fix: enhance safe session monitoring (#29681)
* add custom attribute for list of user ids on mismatch.
* log request header for all mismatched users for all
requests for N seconds after the mismatch is found, if
LOG_REQUEST_USER_CHANGE_HEADERS is enabled. See toggle
docs for more details.

ARCHBOM-1940
2022-01-06 12:15:31 -05:00
Aarif
6c5b1ef551 fix: updated the imports order to fix quality failure (#29722) 2022-01-06 11:39:33 -05:00
Jawayria
7f5b4a6a47 chore: removed 'wrong-import-order' from disabled imports (#29365)
* chore: removed 'wrong-import-order' from disabled imports
2022-01-06 19:14:51 +05:00
Kshitij Sobti
b5f045dc5f fix: update discussions MFE path [BD-38] [TNL-9347] (#29691)
* fix: update discussiosn MFE path

* squash!: fix tests
2022-01-06 18:34:53 +05:00
Michael Terry
be2b7ba0be Merge pull request #29707 from edx/mikix/sequence-but-not
fix: give proper status code for invalid sequence metadata requests
2022-01-04 15:02:45 -05:00
Michael Terry
712380713b fix: give proper status code for invalid sequence metadata requests
If the sequence metadata view is asked to give metadata for a block
that is not a sequence (or section), give a proper http code back,
rather than throwing an attribute exception.

This avoids a monitoring error being flagged, and lets the frontend
catch this case specially (which the MFE does do, to notice that it
actually has a unit, not a sequence).
2022-01-04 14:30:48 -05:00
uzairr
5a3e67d8f4 refactor: update hibp range function
Refactor range function to check whether the provided password
is properly encrypted or needed to be encrypted.

VAN-789
2022-01-04 15:37:17 +05:00
Felipe Trzaskowski
c0e19ec165 Add new discussions API endpoints to retrieve comments and threads from an user [BD-38] [TNL-8796] [BB-4969] (#29137)
* feat: add api mapping to get comments by course+user

fix: merge the new user comments API by overloading the thread comments API

fix: handle endorsements and fix broken tests

fix: improve the view documentation

fix: unused imports

fix: restrict flagged filter to privileged users

fix: validate course_id properly

* fix: add docstring to the retrieve_all method
2022-01-04 11:21:47 +05:00
attiyaIshaque
43d219bf72 fix: Add security fix in LMS logout redirect_url. 2022-01-03 13:45:03 +05:00
DawoudSheraz
f970ab4566 feat: add admin-only/self accessible verified name field in accounts api 2021-12-29 14:51:10 +05:00
AliAkbar
0141c2b866 fix: fix sec staff-lock email 2021-12-22 16:53:29 +05:00
Attiya Ishaque
51b67ad1df fix: Replace hardcoded 'edx' with platform name. (#29657) 2021-12-22 12:51:56 +05:00
Awais Jibran
371a3ef1c6 fix: add pii sharing allowed flag (#29628) 2021-12-21 15:07:49 +05:00
Waheed Ahmed
c696469734 fix: save for later API ratelimit issue (#29650) 2021-12-21 14:05:55 +05:00
Michael Terry
4418c66171 feat: add masquerading support to learning sequences
Previously, it had some basic manual masquerading by calling the
endpoint with ?user=mytestuser. But this adds standard session
masquerading support to the endpoint as well.

This support is limited by LS's own partition group support. It
only looks at the enrollment track partition currently. Further
FBE and cohort partition support will come later.

But this commit opens up normal session masquerading for:
- Generic student
- Specific student
- Enrollment track

AA-1151
2021-12-20 11:14:07 -05:00