Commit Graph

513 Commits

Author SHA1 Message Date
Awais Qureshi
683e6f9aba refactor: remove unused imports. 2021-03-19 15:22:03 +05:00
Stuart Young
995c6548bb add email to segment traits 2021-03-16 18:07:04 -04:00
Stu Young
5107aa41e9 DENG-803: add traits to segment context for enrollment activated events (#26842)
add traits to segment context for enrollment activated events
2021-03-16 14:28:22 -04:00
Awais Qureshi
094573e901 BOM-2375-student-part2
pyupgrade in student app.
2021-03-10 16:17:22 +05:00
adeelehsan
4d24f4c005 datetimestamp added for account activation event
VAN-390
2021-03-08 11:29:58 +05:00
Michael Terry
9570c1c72b feat: add 'external course updates' experiment flag
When this flag is enabled, users will be 50/50 bucketed into an
experiment where users get course highlights and nudges from an
external service (like sailthru or braze) rather than from
edx-platform via ACE.

AA-661
2021-03-02 14:51:45 -05:00
Dillon Dumesnil
aeb71250e9 AA-513: Ensure user id exists before trying to send event
request.user.id could be None which ends up raising an error in
the analytics package we use.
2021-03-02 09:22:12 -05:00
Matthew Piatetsky
fe8e959559 Merge pull request #26765 from edx/AA-304
Check course outline and course date toggles in addition to courseware toggle for streak
2021-03-01 11:02:50 -05:00
Matthew Piatetsky
69ec9a2599 Check course home toggle in addition to courseware toggle 2021-03-01 09:40:02 -05:00
Carla Duarte
02c46fc016 Merge pull request #26764 from edx/ddumesnil/segment-logout-aa-513
AA-513: Updating to segment instead of backend event
2021-02-26 14:03:40 -05:00
Dillon Dumesnil
7f796e1be1 AA-513: Updating to segment instead of backend event 2021-02-26 13:36:21 -05:00
Dillon Dumesnil
5e2bbd88d5 Merge pull request #26763 from edx/ddumesnil/segment-logout-aa-513
AA-513: Add segment event for logout
2021-02-26 08:04:35 -08:00
Dillon Dumesnil
82d3367923 AA-513: Add segment event for logout 2021-02-26 10:19:13 -05:00
Matthew Piatetsky
3b45a72b8e Create backend for three day streak celebration
This feature uses the first_day_of_streak, last_day_of_streak and last_streak_celebration fields to determine whether the user should see a celebration.
AA-304
2021-02-22 10:50:33 -05:00
Manjinder Singh
cd60646926 fix: Switch anonymous user ID hash from md5 to shake (#26198)
Now that we always return an existing value from the DB rather than trusting that ID generation is deterministic and constant over time, we're free to change the generation algorithm.

Our long term goal is to switch to random IDs, but we need to first investigate the uses of save=False. In the meantime, this is a good opportunity to move away from MD5, which has a number of cryptographic weaknesses. None of the known vulnerabilities are considered exploitable in this location, given the limited ability to control the input to the hash, but we should generally be moving away from it everywhere for consistency.

This change should not be breaking even for save=False callers, since those calls are extremely rare (1 in 100,000) and should only occur after a save=True call, at which point they'll use the stored value. Even if this were not true, for a save=False/True pair of calls to result in a mismatch in output, the first of the calls would have to occur around the time of the deploy of this code.

Co-authored-by: Tim McCormack <tmccormack@edx.org>
 
Co-authored-by: Tim McCormack <tmccormack@edx.org>
2021-02-10 07:37:27 -05:00
Tim McCormack
80a4437f33 fix: Always save generated anonymous user ID in DB; ignore save=False (#26399)
This deprecates `save=False` for several functions and removes all known
usages of the parameter but does not actually remove the parameter.
Instead, it will emit a deprecation warning if the parameter is used.
We can remove the parameter as soon as we feel sure nothing is using it.

Now that we have refactored `anonymous_id_for_user` to always prefer
retrieving an existing ID from the database -- and observed that only a
small fraction of calls pass save=False -- we can stop respecting
save=False. This opens the door for future improvements, such as generating
random IDs or switching to the external user ID system.

Metrics: I observe that 1 in 16 requests for new, non-request-cached
anon user IDs are made with save=False. But 71% of all calls are served
from the request cache, and 99.7% of the misses are served from the DB.
save=False only appear to come from intermittent spikes as reports are
generated and are low in absolute number.

Also document usage/risk/rotation of secret in anonymous user ID
generation as indicated by `docs/decisions/0008-secret-key-usage.rst`
ADR on `SECRET_KEY` usage.

ref: ARCHBOM-1683
2021-02-08 19:16:05 +00:00
Tim McCormack
ac7a9f405b refactor: Remove old version of anonymous user ID generation (#26398)
In commit 2723e0e2/PR #26162, we created a new version of the
`anonymous_id_for_user` method that would make it safe to rotate the
`SECRET_KEY` setting (without changing existing anonymous IDs). This
included a toggle to allow fast reversion to the old code if needed.

This commit removes the old code and the toggle as we are satisfied with
the correctness and performance of the new code.

ref: ARCHBOM-1645
2021-02-05 15:35:16 +00:00
Bianca Severino
e5cc220d96 Merge pull request #26357 from edx/bseverino/proctored-exam-email
[MST-636] Add additional check for proctoring requirements
2021-02-04 09:09:12 -05:00
Bianca Severino
3f5cbcfc6a Check for an existing proctored exam before sending proctoring requirements email 2021-02-03 15:54:52 -05:00
Jawayria
8086ca75f2 Applied pylint-amnesty to student 2021-02-03 15:29:53 +05:00
Bianca Severino
902ab02357 Send proctoring requirements email when enrolled in relevant course mode 2021-02-01 09:44:30 -05:00
Tim McCormack
4359be96f3 Tweaks to anonymous user ID code path monitoring (#26194)
- Use different attribute names for new and old versions of function
- Use a shorter name overall (for ease of analysis)
- Add monitor for fetched-existing case
- Only record computed-stored if `get_or_create` succeeds, but also
  break it into created vs. fetched cases by checking return value
- Correct name of monitor in `except` clause -- that should only happen
  for a race inside `get_or_create` itself. There's a different race in
  the `anonymous_uid_for_user` between fetch and compute/save.
- Other name tweaks

ARCHBOM-1674
2021-01-27 16:12:55 +00:00
Manjinder Singh
2723e0e2bd [ARCHBOM-1645] Modifying anonymous_id_for_user() to handly SECRET_KEY rotation (#26162)
These changes were initially made to make it easier to do SECRET_KEY rotations.  Along the way, we found it made sense to refractor the code as well.

Changes made:
- changed get_to_create to create because now the code should only get to this block when a write is necessary
- added a lookup for anonymous_user_id. This is to return an existing anonymous_user_id rather than calculating. This will mitigate the results of SECRET_KEY rotation.
- Added monitoring to help us make better decisions: should we not sue SECRET_KEY, performance considerations...
- put old function behind toggle in case something goes wrong in production with new code
- refractoring function structure for better understanding
2021-01-27 07:23:19 -05:00
Tim McCormack
0fbd134c55 Add monitoring for anonymous user ID code paths (#26176)
For ARCHBOM-1674 we need more information on how often save=False is
actually used vs. other code paths.
2021-01-26 18:06:39 +00:00
Braden MacDonald
ae16394ee5 Fix: update new runtime's runtime.anonymous_student_id to store in DB
This addresses a longstanding TODO item to make runtime.anonymous_student_id for content libraries v2 work the same way as it does for XBlocks in regular courses, persisting the "context ID" (equivalent to course ID) to the database. This way, if SECRET KEY is changed, existing anonymous IDs will continue to work unchanged.

This is a potentially breaking change, but should mostly affect capa problems using external code graders or Matlab code input, and I'm not aware of any such usage of the new runtime / libraries v2.
2021-01-21 15:38:53 -08:00
Matthew Piatetsky
101c9b6633 Remove uses of the active field on the schedule model in the code.
Removing the active field from the model itself and the database is broken out into a separate ticket (AA-574)
AA-488
2021-01-05 18:25:44 -05:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
JJ
e5e3fcdc1c [REV-1262] Skip enrolling already enrolled users on changes to the user (#25490)
Skip auto-enrolling users if they are already enrolled in their auto-enroll enabled courses to prevent downgrading users from paid course modes to audit/free course modes when they activate their account.
2020-11-09 10:41:58 -05:00
Régis Behmo
87b5463d42 Use SettingDictToggle to document ENTRANCE_EXAMS 2020-10-29 11:11:02 +01:00
syed-awais-ali
b3f1c8c1c7 fix email to which reset link was sent 2020-10-21 18:06:55 +05:00
Dillon Dumesnil
84a60a1f17 AA-385: Adding in migration for LinkedInAddToProfileConfiguration 2020-10-19 12:56:34 -04:00
Dillon Dumesnil
b6dbbb6f83 Merge pull request #25346 from edx/ddumesnil/add-cert-to-linkedin-aa-385
AA-385: Add in LinkedIn Add to Profile to courseware meta API
2020-10-19 07:31:26 -07:00
Dillon Dumesnil
084ab4c10d AA-385: Add in LinkedIn Add to Profile to courseware meta API
A major update to this function allows it to actually autofill the
certificate information again! I believe LinkedIn changed their API
and we never updated our end. This fixes that!
2020-10-16 10:07:38 -04:00
Asad
ffdb7c5053 Added user disable comment/history apis 2020-10-16 14:01:10 +05:00
Omar Al-Ithawi
fc0eb71918 Add USER_ACCOUNT_ACTIVATED signal (#23296)
Plugins can listen to USER_ACCOUNT_ACTIVATED signal to perform custom logic.
2020-09-21 09:57:32 -04:00
adeelehsan
f2e989183c Config model added to upload csv
PROD-1911
2020-07-21 16:19:31 +05:00
Waheed Ahmed
8abb3d70bb Allow entitlements to be used past the enrollment date.
Allow entitlements to be used to upgrade to verified track past the
course enrollment date and before the upgrade deadline

PROD-1497
2020-07-17 16:22:56 +05:00
Ali-D-Akbar
8b857edd80 removing logs, waffle flag and other old data 2020-07-15 17:00:05 +05:00
Ali-D-Akbar
b2755a35a0 optimize course enrollment count query 2020-07-06 12:47:46 +05:00
Michael Terry
450072582e AA-137: Support courseware celebrations
- Add a new CourseEnrollmentCelebration model, which ties a
  course enrollment to some booleans about progress celebrations
- Add serialization of the new model to the existing courseware_api
  app's existing course info view
- Add new API in courseware_api to update a celebration model
2020-06-16 15:19:21 -04:00
Adeel Khan
2383fb3fa6 Improving user locked out logic.
This patch improves on the user locked
out logic by providing a helping message
near locked out. This would help reduce
retries by giving user the option to use
password reset flow to fix the issue.

PROD-1505
2020-06-09 09:36:42 +05:00
Olivia Ruiz-Knott
f72a6556a9 MICROBA-311 Add US State field to UserProfile
Add list of states and field to UserProfile model; add migration; add
state field to relevant serializers and to
ACCOUNT_VISIBILITY_CONFIGURATION. Removes state data if country is
changed to something other than United States.
2020-05-12 13:55:11 -04:00
Feanil Patel
a0f81a17ee Revert "Revert "We don't run into this case anymore so remove it."" 2020-05-05 11:49:18 -04:00
Feanil Patel
ba2c712e4e Revert "We don't run into this case anymore so remove it." 2020-05-04 14:28:54 -04:00
Aarif
98af9ce418 remove useless-supression warnings 2020-05-01 19:42:15 +05:00
Feanil Patel
ff6c0dfa6b We don't run into this case anymore so remove it.
This was added in here as a shim to catch places that were still using
the old version of these models that had an attribute called course_id
instead of the `course` foreign key.  After monitoring production for
two weeks, we can be pretty confident that we've caught most places that
do this.  Removing this code since it should no longer be needed.
2020-04-23 16:27:12 -04:00
Aarif
6ee2089077 fixed warnings for wrong-import-order 2020-04-08 23:43:06 +05:00
Feanil Patel
7c115cca24 Remove the course_id property on student.CourseEnrollment.
It conflicts with an underlying related field on that model which seems
to be getting at the same value from the related table.

Add logging for incorrectly instantiating CourseEnrollment models.
This is to catch any places that might break this that are outside of
edx-platform. Django won't accept `course` values that aren't
course_overviews so we don't need extra logic to test that `course`
values are of the correct type.

fixup! Remove the course_id property on student.CourseEnrollment.
2020-04-06 09:36:35 -04:00
Claudiu Ion
765a6867fd Remove deprecated LogoutViewConfiguration from student models 2020-04-01 18:47:49 +00:00
Cory Lee
c02d761045 Reenabling test now that the renames on the schedules table are completed (#23388)
* Reenabling this since the renames on the schedules table are completed

* Reverting regex change that caused migration to be generated for userprofile
2020-03-17 16:23:14 -04:00