Commit Graph

22621 Commits

Author SHA1 Message Date
David Ormsbee
2cb2265ffe Add request caching to reduce ORM queries
This adds request caching to the following places:
* course expiration wrapper (displayed in Units)
* offer banner generation (displayed in Units)
* get_enrollment
* user_by_anonymous_id
* youtube_disabled_for_course

On a sample course with edx-val enabled, this reduced the queries
for a large sequence from 450 to 155.
2019-12-30 16:19:25 -05:00
Feanil Patel
046feb0cf0 Merge pull request #22649 from edx/feanil/fix_pep8
Fix all E303 pep8 errors.
2019-12-30 13:32:26 -05:00
Feanil Patel
8a7159a324 Fix other pep8 violations. 2019-12-30 13:01:55 -05:00
Feanil Patel
6e3fe00fff Fix all E303 pep8 errors. 2019-12-30 12:25:38 -05:00
Feanil Patel
2df8b8226b Merge pull request #22643 from edx/feanil/2to3_asserts
Run `2to3 -f asserts . -w` on edx-platform.
2019-12-30 12:13:42 -05:00
Feanil Patel
39d3a7ca17 Fix pep8 issues caused by the fixer. 2019-12-30 11:42:04 -05:00
Feanil Patel
61e1eda20d Merge pull request #22644 from edx/feanil/2to3_imports
Run `2to3 -f future . -w`
2019-12-30 11:21:05 -05:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Feanil Patel
70294b0ad2 Run 2to3 -f asserts . -w on edx-platform.
https://docs.python.org/3.5/library/2to3.html#2to3fixer-asserts
2019-12-30 10:22:19 -05:00
Awais Qureshi
928a84f969 BOM-1117
Specifying a namespace in django.conf.urls.include() without providing an app_name is deprecated.
Adding the app_name attribute in the included module.
2019-12-30 18:08:21 +05:00
David Ormsbee
a8992a16dd Merge pull request #21610 from open-craft/samuel/test-oauth2
SE-1071 send user_logged_in signal from my_user_info
2019-12-27 10:34:44 -05:00
aarif
02350e0fee added on_delete parameter to foreign_key and oneToOne fields
changes made to fix issues with quality
2019-12-27 19:59:45 +05:00
Giovanni Cimolin da Silva
d1aeec45ad Remove flaky test related to MockS3Mixin
The MockS3Mixin prevents the correct setup of the ModuleStoreTestCase 
and made this test fail. Since the fix for this wasn't trivial, this 
test was skipped on python 3, and now is removed.
2019-12-27 09:59:25 -03:00
Samuel Walladge
c0b908e02d send user_logged_in signal from my_user_info
A user's last logged in value previously wasn't updated when the user
logs in through the oauth2 flow from the ios mobile app. Here we must
send the user_logged_in signal manually. It's implemented in the
my_user_info mobile rest api endpoint because adding it to where the
oauth2 flow happens is to complex, and the mobile app hits this endpoint
after a successful login anyway.
2019-12-27 09:37:22 +10:30
Feanil Patel
f359c9cd8f Merge pull request #21197 from open-craft/giovanni/upgrade-pymongo
BB-1744: Bump pymongo version and fix course export issue
2019-12-26 11:16:15 -05:00
Awais Qureshi
9bae9c0f55 Merge pull request #22595 from edx/awais786/BOM-1111
BOM-1111
2019-12-23 21:29:46 +05:00
Awais Qureshi
5f6b2db31b BOM-1111
Updating User.is_authenticated and User.is_anonymous as properties
2019-12-23 17:51:27 +05:00
Alan Zarembok
be8fef3513 PROD-1113: Fix retry_failed_photo_verifications to work when no database arguments exist. 2019-12-20 17:52:03 -05:00
Feanil Patel
640e8cc9c8 Only store bytes to s3 via boto2.
https://github.com/boto/boto/issues/2868

In python 3 contentfile can act like a file but return unicode strings.
Boto doesn't like that and it causes issues when encoding the bytes for
transfer to s3.
2019-12-20 11:57:32 -05:00
David Ormsbee
62eeabd1bc Merge pull request #22427 from open-craft/anonymous-user-state
Support anonymous users with new (Blockstore-based) XBlock Runtime
2019-12-20 10:28:41 -05:00
Braden MacDonald
f31dc19887 Support anonymous users in the Blockstore-based XBlock runtime
Implementation details:
* Anonymous users are assigned a unique ID (like 
  `anon42c08f9996194e2a9339`) which gets stored in the django session.
  `block.scope_ids.user_id` and `block.runtime.anonymous_student_id`
  will both return this value.
* User state for anonymous users is stored in the django cache and
  automatically expires as the cache gets pruned. Because user state is
  stored, anonymous users can use interactive blocks like capa problems.
* There is no mechanism for upgrading to a registered account and
  keeping user state since the user state store for anonymous users
  (EphemeralKeyValueStore) is completely different than the one for
  registered users (DjangoKeyValueStore/"CSM"), and has no "list all
  keys" functionality.
* "User State Summary" field values are shared among [recently active]
  anonymous users but are not shared with registered users.
* Anonymous users can only access the `public_view` of XBlocks, not the
  regular `student_view`.
2019-12-19 16:12:24 -08:00
Feanil Patel
2cae30cd92 Instantiate idv attempt with a string photo_id_key.
When we run the management command, the photo_id_key is retrieved
through the orm and so is represented as a string.  However, when we do
the initial attempt, the object is instantiated and we refer to the key
without having decoded it.  The photo_id_key is sent as a part of the
request to software secure.  And if we have a byte representation their
signature checking will fail.

This is why the management command worked even when the site didn't.
It was getting a cleaned key via the orm.
2019-12-19 16:18:02 -05:00
Simon Chen
682a450362 Fix the bug where we return many programs if the number of courses the staff user is enrolled in are many 2019-12-19 15:00:43 -05:00
Calen Pennington
c83d0e2ca8 OverwriteStorage was removed from django-storages, so pull it into edx-platform (for now?) 2019-12-19 14:06:30 -05:00
George Babey
6546d394fe Merge pull request #22510 from edx/hasnain-naveed/ENT-2452
ENT-2452, ENT-2068 | Made the lms and learner portal alerts responsiv…
2019-12-19 09:10:23 -05:00
Zainab Amir
d2ca9a02d1 Disable Audit Certs for Whitelisted Students (#22401)
Ensure that certificate is not generated if a learner enrolled in
audit mode is whitelisted

PROD-978
2019-12-19 17:06:33 +05:00
Zaman Afzal
f20a064a0c ENT-2500 Bypass multiple enterprise selection page for SAML user (#22459) 2019-12-19 13:16:38 +05:00
Feanil Patel
972aa3fd4e Merge pull request #22567 from edx/feanil/fix_id_verification_errors
Ensure that photo verification data is correctly typed.
2019-12-18 16:31:52 -05:00
Jansen Kantor
92e833d565 add api function and teams service (#22515)
* add api function and teams service
2019-12-18 15:05:02 -05:00
Matthew Piatetsky
652b49c5ac Merge pull request #22550 from edx/REV-1064
[REV-1064] show discount in sidebar and sock
2019-12-18 14:08:22 -05:00
Feanil Patel
3808b2991c Ensure that photo verification data is correctly typed.
There were cases where we needed to encode things to codecs other than
ascii.  In these cases, python returns byte strings but we needed them
to be unicode so that they serialize correctly later when we combine
them with other unicode strings.
2019-12-18 13:54:37 -05:00
Calen Pennington
3633d7148e Merge pull request #22424 from eduNEXT/dmo/INCR-562
INCR-562 @require_certificate_permission parameters added
2019-12-18 13:25:28 -05:00
Robert Raposa
2e2ceeae8d update logistration js to require json
This is Part 3 of clean-up for removing the shim from
LoginSessionView.post.  Not that the shim should be gone, the frontend
code can be simplified to always provide the shimless version of the
code.

ARCH-1253
2019-12-18 10:20:18 -05:00
DawoudSheraz
bb02732d37 update user check in user state service 2019-12-18 11:16:43 +05:00
Matthew Piatetsky
3a54df511a show discount in sidebar and sock 2019-12-17 09:09:19 -05:00
Calen Pennington
31d96dbc47 Merge pull request #22549 from cpennington/git-revision-on-disk
Read the current edx-platform git revision from a file on disk
2019-12-17 08:57:41 -05:00
Troy Sankey
22f8b65228 Add history to GeneratedCertificate
DE-1881
2019-12-17 17:50:25 +05:00
Calen Pennington
11e163d420 Read the current edx-platform git revision from a file on disk 2019-12-17 07:44:28 -05:00
DawoudSheraz
5178256f3c add user state service in module render 2019-12-16 11:20:55 +05:00
David Moreno
c519196022 @require_certificate_permission parameters added 2019-12-13 15:55:59 -05:00
Matt Tuchfarber
5039ec6a01 Merge pull request #22519 from edx/tuchfarber/enable_devstack_theming
Adds optional setting to enable devstack theming
2019-12-13 12:56:28 -05:00
Feanil Patel
1411ef548c Merge branch 'master' into release-mergeback-to-master 2019-12-13 10:28:35 -05:00
hasnain.naveed
11f305b944 ENT-2452, ENT-2068 | Made the lms and learner portal alerts responsive. Added the lms alert's style in learner portal alert. 2019-12-13 17:59:52 +05:00
Hasnain Naveed
2316aba391 Merge pull request #22456 from edx/hasnain-naveed/ENT-1961
ENT-1961 | Making the manual enrollment reason field optional via con…
2019-12-13 11:03:20 +05:00
Diana Huang
ddf3a8208f Remove items from a different dictionary than the one we're
iterating over.
2019-12-12 15:18:01 -05:00
Matt Tuchfarber
3e94db7449 Adds optional setting to enable devstack theming
The mako engine isn't able to find themed templates in devstack because
the path it checks is set before we enable comprehensive theming. This
Adds a settings section to  comment out if you want to enable
theming in devstack.
2019-12-12 14:31:54 -05:00
Diana Huang
e005c0461e Handle the caching of responses between Python 2 and Python 3. 2019-12-12 11:18:43 -05:00
Robert Raposa
d79e7df32b use login_ajax for logistration
- use login_ajax (in place of login_session with shim) for
logistration's call to login POST
- add toggle for using login_ajax from logistration
  - FEATURES['ENABLE_LOGIN_POST_WITHOUT_SHIM']
- add custom metrics for redirect_url
- update test for third-party auth error_code

NOTE: The error_code `third-party-auth-with-no-linked-account`
was introduced in JSON in this earlier PR:
https://github.com/edx/edx-platform/pull/22452/files

ARCH-1253
2019-12-12 10:39:49 -05:00
Zainab Amir
3e426ccecc Suppress grade on dashboard (#22471)
Learners should not be able to view final grade before course end
date.Suppress the grade achieved so far till course end date on
dashboard.

PROD-701
2019-12-12 17:22:58 +05:00
Diana Huang
28ce0e6739 Add logging middleware to determine why our responses are bad. 2019-12-11 17:01:07 -05:00