Commit Graph

44 Commits

Author SHA1 Message Date
Kyle McCormick
1f392bdc3e fix: render_xblock was denying access to staff masquerading as learners (#27017)
The render_xblock view, which powers the Learning
MFE (among other things) returned a 404 when un-
enrolled course staff users tried to load it while
masquerading as learners. This was because we
checked course access after enabling the
masquerading context, which triggered a redirect-
to-enrollment exception.

The fix is simply to enable the masquerading
context after checking course access.
Content-level behavior and access is still
calculated within the masquerading context,
as intended.

TNL-7989
2021-03-15 16:50:33 -04:00
Usama Sadiq
859df03049 refactor: ran pyupgrade on lms/djangoapps/courseware (#26737) 2021-03-12 12:15: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
Kyle McCormick
558d2eb52c refactor: centralize learning MFE URL-building logic (#26689)
In preparation for switching LMS/Studio over
from serving legacy courseware URLs in certain
places (for example, resume_course_url) to serving
learning micro-frontend URLs.

TNL-7796
2021-02-24 08:50:15 -05:00
Jawayria
03e6a874d0 Applied pylint-amnesty to courseware 2021-02-03 21:56:24 +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
Calen Pennington
a04690d051 Increase the mongo query count by one because edxnotes has been turned back on, and it loads the course from the modulestore as part of get_html 2020-09-25 14:13:30 -04:00
Calen Pennington
2a157ae854 Lower query counts 2020-09-23 10:05:37 -04:00
Simon Chen
262574b815 Move all the upgrade display logic into courseware.utils 2020-05-05 17:54:22 -04:00
Simon Chen
34d4d162f7 MST-108 Add masquerading fix to the upgrade message display 2020-05-01 16:54:43 -04:00
Aarif
98af9ce418 remove useless-supression warnings 2020-05-01 19:42:15 +05:00
Feanil Patel
6e3fe00fff Fix all E303 pep8 errors. 2019-12-30 12:25:38 -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
Dave St.Germain
267be29ab7 Added edx-when's FieldData
EDUCATOR-4554
This fixes a bug where extended due dates were visible in the outline but not reflected on the courseware pages, resulting in problems not being submittable past the due date.
In order for edx-when to work on courseware pages, it has to be more careful about field inheritance, which version 0.2 achieves.
2019-08-12 11:05:44 -04:00
aarif
64bd86c12c ran python-modernize and isort on files mentioned in INCR-435 2019-07-12 15:29:19 +05:00
Jeremy Bowman
d671c4b1d0 TE-2689 Remove useless pylint suppressions part 1 2018-08-13 17:01:21 -04:00
Usman Khalid
8b1aad080a Add complete on view support to render_xblock view. 2018-06-22 14:46:03 -04:00
Harry Rein
58f93cc7cc Styling fixes for the dashboard and course header. 2017-10-29 15:04:29 -04:00
Calen Pennington
12e1af275a Merge pull request #16092 from edx/upsell-nudges-for-unverified-users
Upsell nudges for unverified users
2017-10-13 11:32:29 -04:00
Calen Pennington
8468357ac4 Separate the date and link logic out of VerifiedUpgradeDeadlineBlock, so that it can be called directly with prefetched data for check_and_get_upgrade_link_and_date 2017-10-13 10:01:34 -04:00
Andy Armstrong
374cdb0a3d Convert course home page to Bootstrap
LEARNER-1694

Fix a11y failure

Fix header styling

Fix layout issues

Further layout fixes
2017-10-10 20:18:27 -04:00
Clinton Blackburn
986afbfa38 Powering courseware deadline with schedules 2017-08-05 22:06:17 -04:00
Clinton Blackburn
5db02ef673 Added support for dynamic upgrade deadlines
The verified seat upgrade deadline for self-paced course runs is now
dependent on when the learner was first able to access the content--the
latest of enrollment date and course run start date.
2017-07-28 15:44:35 -04:00
Andy Armstrong
79acb5c5be Reorder LMS imports using isort 2017-06-11 21:48:06 -04:00
Diana Huang
3e71a45349 Only show preview bar if student can view it. 2017-05-18 09:16:28 -04:00
cahrens
e5035746bf Introduce EnrollmentTrackUserPartition.
TNL-6674
2017-03-30 12:24:48 -04:00
David Ormsbee
2051c90924 Test Speedup: Isolate Modulestore Signals
There are a number of Django Signals that are on the modulestore's
SignalHandler class, such as SignalHandler.course_published. These
signals can trigger very expensive processes to occur, such as course
overview or block structures generation. Most of the time, the test
author doesn't care about these side-effects.

This commit does a few things:

* Converts the signals on SignalHandler to be instances of a new
  SwitchedSignal class, that allows signal sending to be disabled.

* Creates a SignalIsolationMixin helper similar in spirit to the
  CacheIsolationMixin, and adds it to the ModuleStoreIsolationMixin
  (and thus to ModuleStoreTestCase and SharedModuleStoreTestCase).

* Converts our various tests to use this new mechanism. In some cases,
  this means adjusting query counts downwards because they no longer
  have to account for publishing listener actions.

Modulestore generated signals are now muted by default during test runs.
Calls to send() them will result in no-ops. You can choose to enable
specific signals for a given subclass of ModuleStoreTestCase or
SharedModuleStoreTestCase by specifying an ENABLED_SIGNALS class
attribute, like the following example:

    from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase

    class MyPublishTestCase(ModuleStoreTestCase):
        ENABLED_SIGNALS = ['course_published', 'pre_publish']

You should take great care when disabling signals outside of a
ModuleStoreTestCase or SharedModuleStoreTestCase, since they can leak
out into other tests. Be sure to always clean up, and never disable
signals outside of testing. Because signals are essentially process
globals, it can have a lot of unpleasant side-effects if we start
mucking around with them during live requests.

Overall, this change has cut the total test execution time for
edx-platform by a bit over a third, though we still spend a lot in
pre-test setup during our test builds.

[PERF-413]
2017-02-23 10:31:16 -05:00
Dmitry Viskov
fc0577d081 Hide bookmarks link in the LTI mode 2016-12-22 09:56:33 -05:00
asadazam93
01f3233a50 Fix InvalidKeyError on render xblock 2016-12-20 13:03:50 +05:00
Nimisha Asthagiri
d0fcabd407 CCX: Use Modulestore Field Overrides instead of User-specific Overrides 2016-06-23 20:22:32 -04:00
Andy Armstrong
7e2a174eec Move discussion board to the Pattern Library
TNL-4622
2016-06-02 12:48:12 -04:00
Peter Fogg
505b2aa4d9 Disable setting course pacing during course run.
Also adds improved styling for course pacing settings, and unit tests
around query counts for self-paced courses.

ECOM-2650
2015-10-28 16:44:36 -04:00
clrux
0b64f2d612 Merge pull request #9525 from edx/clrux/ac-76
LMS: Course navigation revamp
2015-09-23 14:26:10 -04:00
Ahsan Ulhaq
508ded2673 LMS: course navigation menu refactor 2015-09-23 13:13:18 -04:00
Nimisha Asthagiri
31d5d513f8 MA-1337 xBlock Rendering View 2015-09-21 16:17:11 -04:00
clrux
5b545c2b0d Revert "Course navigation menu accessibility issue" 2015-08-28 13:28:08 -04:00
Chris Rodriguez
c9b775bda2 wip test fixes 2015-08-28 07:50:33 -04:00
zubair-arbi
ec28a75f14 In-course reverification access control
* Automatically create user partitions on course publish for each ICRV checkpoint.
* Disable partitions for ICRV checkpoints that have been deleted.
* Skip partitions that have been disabled when checking access.
* Add verification access control UI to visibility settings.
* Add verification access control UI to sequential and vertical settings.
* Add partition scheme for verification partition groups.
* Cache information used by verification partition scheme and invalidate the cache on update.
* Add location parameter to UserPartition so the partition scheme can find the associated checkpoint.
* Refactor GroupConfiguration to allow multiple user partitions.
* Add special messaging to ICRV for students in the honor track.

Authors: Zubair Arbi, Awais Qureshi, Aamir Khan, Will Daly
2015-08-20 08:43:55 -07:00
Ned Batchelder
f54fe787c6 Remove needless 'disable=no-member' pragmas 2015-08-03 17:47:44 -04:00
Akiva Leffert
6084f4df27 Make render_xblock return a 404 if access check fails
The mobile clients need the request to fail if they don't have
permisssions so that they know to refresh a session token.

JIRA: https://openedx.atlassian.net/browse/MA-1003
2015-07-13 15:56:58 -04:00
Akiva Leffert
07fda73ffa Remove border from chromeless xblock
JIRA: https://openedx.atlassian.net/browse/MA-972
2015-07-01 12:11:15 -04:00
Phil McGachey
c3106bc4bd This change cleans up the work in progress request at #8176
This is an initial authentication implementation that allows LTI users to
log in transparently to edX. The behavior is driven by pilot users at
Harvard; this was the most requested feature.

The patch creates a new database model that maps users' LTI identifiers
to newly-created edX accounts. If an LTI launch comes in with a user_id
field that is not in the database, a new edX account is created with a
random user name and password. This account is then stored in the
database, so that it is permanently associated with the LTI user ID.

This patch takes a simplistic approach to session management. If a user
is logged in with a different account when they perform an LTI launch,
they will be logged out and then re-logged in using their LTI account.

In order to keep the patch simple, I have split out some refactoring
that needs to be done into a separate branch that I'll post once this
has been merged. Since we no longer redirect to the login page, we don't
need to maintain two separate LTI endpoints (one for the LTI launch and
one for authenticated users), or deal with the session management that
requires. There are also multiple fetches of the LtiConsumer object
(one in the view, one in the signature validation) that the later
patch will consolidate into one.

This branch fixes the previous conflicts with the test refactoring
carried out in PR 8240.
2015-06-12 10:21:48 -04:00
Phil McGachey
0c7623d530 [LTI Provider] Fix bug preventing unenrolled users from accessing content
Change https://github.com/edx/edx-platform/pull/8240 refactored the LTI
provider template rendering code and introduced an issue where a user was
required to be enrolled in a course before that course's content could be
accessed over LTI. According to the LTI design spec:
    https://docs.google.com/document/d/185hdPvIxcKtiDOLjb4sTGovA_WYXWz5Cd79gCzQwBms
we delegate access control over LTI content to the LTI consumer, rather
than requiring that users enroll in edX courses explicitly (and that admins
keep edX and LTI provider enrollemnts consistent when students add or drop
courses).

This change fixes the immediate issue, which is disrupting the LTI Provider
pilot currently running at Harvard.
2015-06-08 23:01:43 -04:00
Nimisha Asthagiri
d240785b17 MA-722 Render xBlock API Support 2015-06-05 11:18:48 -04:00