Commit Graph

74 Commits

Author SHA1 Message Date
Jawayria
df06d1312d refactor: Removed unused imports
Removed unused imports from openedx/core/djangoapps/{content_libraries, coursegraph,courseware_api, crawlers, credentials, credit}
2021-04-06 17:07:13 +05:00
Ben Holt
ec3c31eb05 feat: added another 'Date' expose-headers for outline api clients (#27221)
Exposed the Date header on the outline api so clients can accurately compute times relative to the dates returned by the API; this was previously done with the course API (#26979)

Browser time is notoriously unreliable for this, especially for a Learner-facing countdown call-to-action based on the access expiration date. (REV-2126)

Using the Date header for this allows the client to make use of information that is already sent, does not require additional calls nor modifying the API, and could be generalized to more or all our APIs without modifying them.
2021-04-02 10:37:19 -04:00
Usama Sadiq
369885002d refactor: ran pyupgrade on openedx apps (#26846)
Ran pyupgrade on openedx/core/djangoapps/{coursegraph, courseware_api, crawlers}
2021-03-16 15:15:35 +05:00
Ben Holt
e93f035876 feat: exposed 'Date' header so clients can compute accurate relative time (#26979) REV-2126
Exposed the Date header so clients can accurately compute times relative to the dates returned by the API; browser time is notoriously unreliable for this, especially for a Learner-facing countdown call-to-action based on the access expiration date. (REV-2126)

Using the Date header for this allows the client to make use of information that is already sent, does not require additional calls nor modifying the API, and could be generalized to more or all our APIs without modifying them.
2021-03-15 14:43:00 -04:00
Kyle McCormick
f50a2138e4 fix: masquerading as a role in MFE should not require enrollment (#26975)
The Learning MFE had a bug where instructors selecting
'View As: Audit' would find themselves redirected to the
'Enroll Now' page. This was because the Courseware API,
 which powers the MFE, checked courseware access *after*
setting up masquerading--so, instead of checking whether
the instructor had access to view the course, we checked
whether some arbitrary un-enrolled learner would have
access to the course (the answer is generally No).

We fix this by doing what the Legacy courseware index
does: calculate courseware access *before* setting up
masquerading.

TNL-7989
2021-03-12 12:13:45 -05:00
Carla Duarte
99f73312b8 Progress Tab 2021-03-11 15:43:58 -05:00
Kyle McCormick
9b37e7d0fe refactor: centralize checks for canonical courseware experience & URL (#26815)
Centralize the logic for choosing between
MFE and Legacy-frontend courseware within
three new functions:
* courseware_mfe_is_active
* courseware_mfe_is_visible
* courseware_legacy_is_visible

This allows us to create another new function:
* get_courseware_url
which can be called anywhere in LMS/Studio
to get the canonical URL to courseware
content (whether it be MFE or Legacy).

In future commits we we begin using
get_courseware_url throughout the platform.

TNL-7796
2021-03-08 15:24:16 -05:00
Matt Tuchfarber
6c97dfe1e5 Move cert date signals to avoid race conditions
COURSE_CERT_DATE_CHANGE was being called before saving the new data in
the course overview. The listeners were expecting to pull the data out
of the course overview, and thus were only right about half the time.
This moves the signal to trigger after the course publish signals are
handled.
2021-03-04 15:57:21 -05:00
jawad khan
948d6351b6 LEARNER-8251 - Added BearerAuthenticationAllowInactiveUser in courseware view (#26829)
Added BearerAuthenticationAllowInactiveUser in courseware view
2021-03-03 18:39:42 +05:00
Kyle McCormick
e792242b5f refactor!: remove redundant ENABLE_COURSEWARE_MICROFRONTEND toggle (#26792)
The Django setting
FEATURES['ENABLE_COURSEWARE_MICROFRONTEND']
has been an additional gate to activating
usage of the Learning MFE for an Open edX
instance.

The toggle is redundant with the
`courseware.courseware_mfe`
Waffle flag. By removing it, we simplify our config
and simplify our path towards making the Learning MFE
the default courseware experience.

TNL-7796
2021-03-02 11:36:43 -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
Zainab Amir
c260f72c2e VAN-311: Add multiple enterprise support for Authn MFE (#26526) 2021-02-18 17:24:44 +05:00
Carla Duarte
7f7edd93c7 Merge pull request #26440 from edx/ciduarte/AA-590
AA-590: pass translated tab titles to MFE
2021-02-09 08:57:10 -05:00
jawad khan
95580b79a7 LEARNER-8218 Added BearerAuthenticationAllowInactiveUsern in celebration api
Added BearerAuthenticationAllowInactiveUsern in celebration api
2021-02-09 12:52:12 +05:00
Carla Duarte
00a025f073 AA-590: pass translated tab titles to MFE 2021-02-08 17:00:33 -05:00
Matthew Piatetsky
b91f720b7e Merge pull request #26293 from edx/AA-613
[AA-613] Return content type gate for staff users when masquerading as the Learner in Audit or Learner in Limited Access Roles
2021-02-05 09:18:34 -05:00
Matthew Piatetsky
ae7d0a1ed8 Return content type gate for staff users when masquerading as the Learner in Audit or Learner in Limited Access Roles
This is necessary to display the content type gate in the UI
AA-613
2021-02-04 17:34:16 -05:00
M. Zulqarnain
96ff0734f7 BOM-2320 : Pylint amnesty in course apps under openedx (#26348)
* pylint amnesty in course apps under openedx
2021-02-04 15:34:14 +05:00
Matthew Piatetsky
84fb4679c9 Add contains_content_type_gated_content attribute to display items in the Sequence Metadata API. This attribute is used to display the content type gating paywall in frontend-app-learning.
Also, refactor existing timed exam code that checks for content_type_gated_content in a sequence to make it try with the new code
AA-613
2021-01-28 12:00:53 -05:00
Carla Duarte
99163bdf2c AA-131: Allow anonymous users through course home MFE 2020-12-16 12:58:33 -05:00
Michael Terry
cf2e778b56 TNL-7185: clean up unused html blobs from the API
Now that the MFE consumes our data structure for a couple of the
alerts, we no longer need to send raw html at all for them.
2020-12-14 14:26:10 -05:00
Michael Terry
eef72b5ab7 TNL-7185: Send data, not rendered HTML to the learning MFE
Specifically, send data versions of course_expired_message and
offer_html.

The rendered HTML is still being sent for now, until the learning
MFE is updated to consume the data objects.
2020-12-14 13:41:03 -05:00
Carla Duarte
774210cf33 Merge pull request #25805 from edx/ddumesnil/aa-503
AA-503: Add id verification status into API
2020-12-09 14:37:04 -05:00
Dillon Dumesnil
a7e712ad4e AA-503: Add id verification status into API
This will be used for the Course Exit experience to improve our
messaging for learners in the 'pending' state
2020-12-08 20:08:52 +00:00
Michael Terry
ae561256cb AA-383: add verified mode info to course_home outline API
Adds can_show_course_sock and verified_mode values to the outline
API serialization. And adds a utility method to generate the
verified_mode dictionary, shared with the courseware API.
2020-12-04 14:26:38 -05:00
Simon Chen
00ad36839d MST-542 Roll out Accounts MFE IDV workflow (#25613)
* MST-542 remove the IDV redirect to Account MFE waffle flag to permanently redirect learners to new IDV workflow. This completes the rollout process on edx-platform
2020-12-01 09:08:12 -05:00
Carla Duarte
0ee7546379 Merge pull request #25541 from edx/ciduarte/AA-199
AA-199: Surfacing program progress in courseware API
2020-11-16 14:03:41 -05:00
Carla Duarte
9545ae8868 AA-199: Surfacing program progress in courseware API 2020-11-16 11:57:50 -05:00
Michael Terry
7697b7dd46 When masquerading in courseware API, reset the request user
It's important that request.user be set as the effective user,
because waffle flags and bits of code around the place look at it.

This should make masquerading more accurate to what the learner
sees.
2020-11-13 12:58:18 -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
Michael Terry
a4bd5a7ec9 AA-197: Provide cert upgrade info to learning MFE
Specifically, pass the MFE the audit access expiration date and
let it know when the upgrade deadline has passed, by not passing
any verified mode information along.
2020-10-27 09:05:12 -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
Dillon Dumesnil
fa2277bb6b Check if effective_user is anonymous before trying to get grade
I saw locally that it caused an error if you hit the endpoint directly
so just being defensive.
2020-10-06 12:49:03 -04:00
Dillon Dumesnil
a96079f2d1 AA-196: Course Celebration for passing Verified Learners 2020-10-01 16:53:25 -04:00
Nicholas D'Alfonso
91282b8af0 AA-196 course celebration cert 2020-10-01 12:09:24 -04:00
Michael Terry
6f69fd7dc2 Merge pull request #25105 from edx/mikix/public-outline
AA-253: don't send outline if not enrolled
2020-09-28 11:46:22 -04:00
Michael Terry
100018081d AA-253: don't send outline if not enrolled
This is for the learning MFE outline endpoint.

Also clean up some related permissions issues.
2020-09-28 10:45:07 -04:00
Kyle McCormick
ef845ebc43 Fully qualify remaining edxnotes imports 2020-09-25 14:13:30 -04:00
Bill Currie
d06d933c95 Convert InvalidKeyError exception to NotFound
This fixes the execption in lms when accessing a blank course via the
front-end-learning MFE.
2020-08-24 17:39:09 +06:00
David Joy
c6ae82db57 Implement kill-switch for the Learning MFE
by overriding can_load_courseware if the MFE is disabled for the user

If the user would be allowed to see the courseware MFE
(can_load_courseware), we check whether the MFE is disabled for them,
based on global settings, course settings (mongo courses), or their
particular bucketing in our ExperimentWaffleFlag.

If we determine they shouldn’t be allowed to see it, we return a new
CoursewareMicrofrontendDisabledAccessError access response, which the
MFE will use to know it should redirect to the old LMS experience.

Fixes: TNL-7362
Co-authored-by: stvn <stvn@mit.edu>
2020-08-13 12:05:49 -07:00
Manjinder Singh
c76ed6ae45 Extracting plugin app from edx-platform (#24678)
* Moving plugins infrastructure to edx-django-utils
This PR extracts the code that enables plugins in edx-platform and puts it in edx-django-utils. This is done to allow other IDAS to add plugin functionality.
2020-08-12 07:48:53 -04:00
Dillon Dumesnil
c66bc865b6 AA-275: Persist Masquerade User staff status
We need both the original user's staff status as well as
the staff status of the user being masqueraded as.
2020-08-05 08:03:55 -07:00
Patrick Cockwell
129ed1b9ab TNL-7303 Add course license details to Courseware API (#24393) 2020-07-17 10:15:21 -04:00
Michael Terry
3030efec78 AA-177: Add masquerading for course home MFE
- Looks at masquerading config for dates, outline, metadata, and
  celebration APIs in course_home_api / courseware_api.
- Consolidates and cleans up places we check whether masquerading
  gives us full access to a course.
2020-06-29 12:37:47 -04:00
stvn
994b2b002f Add explicit masquerade support to courseware API 2020-06-18 14:54:49 -07: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
Michael Terry
f88b4d75f0 Add marketing_url to courseware_api
This will let the courseware MFE point at a course's marketing page.

AA-137
2020-06-05 09:10:15 -04:00
stvn
0f57bff0cb Merge PR #23979 fix/courseware-api-verified-mode
* Commits:
  Check if user can upgrade prior to showing sock upgrade
2020-05-14 15:50:16 -07:00
stvn
51803d33ff Check if user can upgrade prior to showing sock upgrade 2020-05-14 15:09:04 -07:00