Commit Graph

5629 Commits

Author SHA1 Message Date
Usama Sadiq
25b275bca4 refactor: Ran pyupgrade on openedx/core/djangoapps
Ran pyupgrade on openedx/core/djangoapps/{xblock, xmodule_django, zendesk_proxy}
2021-04-07 18:57:52 +05:00
Usama Sadiq
ac8c3b6a03 refactor: Ran pyupgrade on openedx/core/djangoapps
Ran pyupgrade on openedx/core/djangoapps/{util, verified_track_content}
2021-04-07 18:57:12 +05:00
Usama Sadiq
d540688f8e refactor: Ran pyupgrade on openedx/core/djangoapps/user_authn 2021-04-07 18:54:33 +05:00
Piotr Surowiec
bc1e9afe4b feat: allow overriding unit icons (#21433)
This:
1. Introduces a new override using the `pluggable_override` decorator.
It is now possible to specify a custom way of getting XBlock's icon
by defining `GET_UNIT_ICON_IMPL` in settings.
2. Introduces a way to add custom `XBLOCK_MIXINS` by defining
`XBLOCK_EXTRA_MIXINS` in settings. This allows, e.g. to add
new fields to XBlocks.
2021-04-07 09:42:12 -04:00
Muhammad Ammar
9d7e804236 Merge pull request #27255 from edx/ammar/update-cache-key-for-dsc
update cache key for DSC
2021-04-07 15:27:42 +05:00
Jawayria
cf81718b10 Merge pull request #26601 from edx/jawayria/bom-2408-4
BOM-2408: Remove unused imports from openedx/core/djangoapps/{dark_la…
2021-04-07 12:56:37 +05:00
Jawayria
a4744dfde1 Merge pull request #26600 from edx/jawayria/bom-2408-3
BOM-2408: Removed unused imports from openedx/core/djangoapps/{conten…
2021-04-07 12:56:20 +05:00
Zaman Afzal
194f29ca55 ENT4134 Add the support for multiple IDPs (#27073)
* ENT4134 Add the support for multiple IDPs
2021-04-06 23:27:20 +05:00
Robert Raposa
280f8e1577 docs: improve CourseWaffleFlag admin docs
Improve the docs for how to configure CourseWaffleFlag
overrides via Django admin.

ARCHBOM-1721
2021-04-06 11:05:44 -04:00
muhammad-ammar
3929d098b6 update cache key for dsc 2021-04-06 17:34:42 +05:00
Jawayria
8fc7333982 Refactor: Remove unused imports
Removed unused imports from openedx/core/djangoapps/{dark_lang, django_comment_common, embargo, lang_pref, oauth_dispatch, plugins, programs, schedules}
2021-04-06 17:11:59 +05:00
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
Usama Sadiq
91ea53da56 refactor: Ran pyupgrade on openedx/core/djangoapps/user_api 2021-04-06 12:50:48 +05:00
Usama Sadiq
c14eab1332 refactor: Ran pyupgrade on openedx/core/djangoapps/site_configuration 2021-04-06 12:50:34 +05:00
Usama Sadiq
ebcf204d60 refactor: ran pyupgrade on openedx/core/djangoapps
ran pyupgrade on openedx/core/djangoapps/{schedules, self_paced, service_status}
2021-04-06 12:50:11 +05:00
Simon Chen
1d186b34bf MST-734 Fix production issue on Learner Onboarding Status Panel (#27248)
* MST-734 Fix production issue on Learner Onboarding Status Panel
Fix the prod issue where learning sequence service object missing the needed get_user_course_outline service API
The user web API call currently returns 500
2021-04-05 16:54:58 -04:00
Robert Raposa
96be45f1bd Merge pull request #27222 from edx/robrap/ARCHBOM-1721-toggle-doc-cleanup
ARCHBOM-1721: docs: update toggle docs
2021-04-05 10:47:55 -04:00
Feanil Patel
9f4a8e6724 Merge pull request #27233 from edx/feanil/flag_management
feat!: Replace logging WaffleSwitch with a django settinge.
2021-04-02 15:12:11 -04:00
Feanil Patel
ba4d98898e Merge pull request #27231 from edx/feanil/more_safe_sessions_updates
fix: Reduce safe-sessions false alarms.
2021-04-02 14:45:22 -04:00
Feanil Patel
8e7144ae2e revert: "test: Update query counts."
This reverts commit c2eabf6cca.

We are changing this from a waffle setting to a django setting so we can
undo this query count bump.
2021-04-02 14:42:55 -04:00
Feanil Patel
455033458c feat!: Replace logging WaffleSwitch with a django settinge.
This was initially introduced as a temporary flag to be able to get more
information.  But if we get this kind of issue again, we'll need
something like this logging to determine the source of the session
collision.  Rather than removing the code and adding it back in later,
convert this temporary switch into an opt-in setting that can be used
again in the future.

BREAKING_CHANGE: 'safe_session.log_request_user_changes' switch no
longer exists and is replaced with the 'LOG_REQUEST_USER_CHANGES' django
setting which defaults to 'False'
2021-04-02 14:20:07 -04:00
Feanil Patel
c45ffd7509 test: Test login redirects prefer session cookies.
Add a test to ensure that the login page redirect as long as we have a
valid session even if we have expired on non-existent JWT cookies.
2021-04-02 14:19:10 -04:00
Feanil Patel
118f095110 fix: Assume logged in if user has a valid session.
Previously they also had to have a valid JWT cookie which led to a weird
corner case where a user was logged in but still showed the login form
resulting in some confusion and odd behavior.

This change gives precedence to the session token to determine whether
or not someone is logged into the LMS but ensures that if you go through
the login flow, you refresh your JWT cookies. This should not cause any
breakage for MFE flows that might redirect to the LMS login page since
the JWT would get refreshed if it's out of date but the session is
valid.
2021-04-02 14:19:10 -04:00
Feanil Patel
23f2b758d4 fix: Print more stack frames on requset tracing.
Six frames was not enough because for DRF views the request gets wrapped
in a proxy object and so we need more of the stack to see what part of
the code we're in that actually invokes the use change.
2021-04-02 14:19:07 -04:00
Jawayria
de2a28bd82 Merge pull request #26598 from edx/jawayria/bom-2408-1
BOM-2408: Removed unused imports from openedx/core/djangoapps/{api_ad…
2021-04-02 19:38:00 +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
Jawayria
55b692aede refactor: Removed unused imports
Removed unused imports from openedx/core/djangoapps/{api_admin, catalog, ccxcon, certificates}
2021-04-02 18:28:16 +05:00
Robert Raposa
8ef8b35a54 docs: update toggle docs
A variety of updates were made to improve the toggle documentation:
* Added comments to help ensure that the waffle(), waffle_switches(),
  waffle_flags() anti-pattern won't be contagious (copied).
* Some minor toggle_description updates.
* Removed empty toggle_target_removal_date annotations for
  non-temporary toggles.
* Removed empty optional toggle_warnings annotations.
* Removed empty optional toggle_tickets annotations.
* Removed deprecated toggle_category, toggle_status,
  and toggle_expiration_date annotations.
* Fixed some indents, use cases, and implementations.

ARCHBOM-1721
2021-04-01 21:58:29 -04:00
Feanil Patel
5b7caf45d6 fix: Don't log warnings on logout.
When a user logs out, there are warnings logged right now because the
session user_id mismatches(it becomes None on logout).  Previously we
would log the request mismatch on debug and the session mismatch as
normal.

This change will result in us logging nothing if the session change is
not abnormal.
2021-04-01 16:42:21 -04:00
M. Zulqarnain
072b6b8875 Revert "chore: Unpin python-dateutil (#27196)" (#27217)
This reverts commit 40878cd554.
2021-04-01 23:32:51 +05:00
Adeel Ehsan
84aca220b8 Merge pull request #27179 from edx/aehsan/van-401/tpa_auth_context_updated
skip hinted login field added in tpa context
2021-04-01 20:08:29 +05:00
M. Zulqarnain
40878cd554 chore: Unpin python-dateutil (#27196) 2021-04-01 19:53:02 +05:00
Usama Sadiq
e9f9fcb17b refactor: Ran pyupgrade on openedx/core/djangoapps/user_api
Co-authored-by: Muhammad Soban Javed <58461728+iamsobanjaved@users.noreply.github.com>
2021-04-01 19:34:01 +05:00
Usama Sadiq
24272e5caa refactor: ran pyupgrade on openedx/core/djangoapps (#26956)
Ran pyupgrade on openedx/core/djangoapps/{system_wide_roles, theming}
2021-04-01 19:27:38 +05:00
Usama Sadiq
0223feb17b refactor: ran pyupgrade on openedx/core/djangoapps (#26955)
ran pyupgrade on openedx/core/djangoapps/{schedules, self_paced, service_status}
2021-04-01 15:00:49 +05:00
Usama Sadiq
4b074c7d9b refactor: Ran pyupgrade on openedx/core/djangoapps (#26936) 2021-04-01 15:00:26 +05:00
adeelehsan
c329de3235 skip hinted login field added in tpa context 2021-04-01 01:16:54 +05:00
Raul Gallegos
0d691623af fix: setting correct i18n_service to blockstore runtime
xblock information was not being translated correctly when using the blockstore runtime. This makes the i18n_service block-specific so it can look for additional i18n files that can be installed with the XBlock
2021-03-31 14:19:01 -05:00
Michael Terry
5d9e7e9fe5 fix: don't count hierarchy blocks as complete for assignments
When considering whether a subsection is complete as an assignment,
skip any "hierarchy" types (sequential, vertical, etc) that don't
have children. If the user can't see the content, don't risk
marking it as complete.

AA-726
2021-03-29 16:06:11 -04:00
Thomas Tracy
9f4e51a241 feat: Add command to generate credentials config (#27088)
Adds a command to create an API connection to credentials for testing
program certificates on devstack. This command is not meant to be ran
manually, and will be included in a provisioning type script that will
be added later.
2021-03-29 10:04:59 -04:00
Feanil Patel
c1bdf01876 fix: Don't make request change logging a waffle flag.
Waffle flags are useful for gradual rollout but that's not possible this
high in the middleware because a lot of the data needed (request.user)
to partition incoming requests is not availabale this high in the
middleware.

Convert this to a WaffleSwitch which will be safer to operate.

Also increase the number of frames in the stack to print per change.
Printing just 1 did not provide enough info because DRF requests wrap
WSGI requests and have a setter proxy.  It will be useful to figure out
how they do this in case it's better that what we're doing in the safe
sessions middleware.

Ticket: https://openedx.atlassian.net/browse/ARCHBOM-1718
2021-03-26 14:38:35 -04:00
Feanil Patel
68bd33f310 Merge pull request #27138 from edx/feanil/add_request_user_change_logging
feat: Add more detailed request user change logging.
2021-03-25 14:01:52 -04:00
Feanil Patel
c2eabf6cca test: Update query counts.
The new WaffleFlag.is_enabled check in middleware increased query counts
for multiple tests.
2021-03-25 12:14:53 -04:00
Feanil Patel
0714ac5f0e feat: Add more detailed request user change logging.
The change is behind a WafleFlag and can be turned on to log every time
the `user` attribute of an instrumented request changes.  This will
significantly increase log volume so it shouldn't be left on all the
time but can be turned on to quickly debug issues related to sessions.

Ticket: https://openedx.atlassian.net/browse/ARCHBOM-1718
2021-03-25 12:14:53 -04:00
Shimul Chowdhury
eba710ccb5 feat: added batch_get_or_create class method for ExternalId (#25844)
* Added batch_get_or_create_user_ids method for ExternalId Model

Update doc string

* Update docstring & fix bug on test

[BD-24] [BB-2726] [TNL-7330]
2021-03-25 12:09:32 -04:00
Waheed Ahmed
b200699fc6 Keep user on FE if there is a running pipeline for SAML IDPs.
For some SAML providers, learners are redirected to MFE and breaking
the flow. Check for running pipeline and if the provider is a SAML
provider keep them on FE.

VAN-425
2021-03-25 18:43:19 +05:00
Zainab Amir
8cc5f13daf Add rate limit to registration endpoint (#27060)
Currently the registration endpoint has no rate limit. Added a new ratelimit
variable to support the change, it's value is set to 60/7d.

VAN-302
2021-03-25 16:28:30 +05:00
Waheed Ahmed
e3406257fe Fix edxloggedin cookie not present issue.
If edxloggedin cookie is not present but the user is authenticated;
user is redirected to authn MFE and then back to dashboard instead
of the desired redirect URL (e.g. finish_auth) resulting in learners
not enrolling into the courses.

VAN-415
2021-03-24 16:26:31 +05:00
Robert Raposa
650b0c1360 Merge pull request #27118 from regisb/regisb/fix-toggle-state-report-typeerror
[BD-21] fix: TypeError in toggle state report view
2021-03-23 17:32:30 -04:00
Régis Behmo
dae4403ba7 fix: TypeError in toggle state report view
We were attempting to add course overrides twice to objects returned in
the toggle state report view. This was causing a TypeError (and thus a
500 error) because the second time, we were attempting to add entries to
an incorrect object.

This issue was not caught by unit tests because we were not testing the
view with WaffleFlagCourseOverride objects. This commit adds a unit test
to prevent future errors.

This is another fix for PR #27108.
2021-03-23 20:33:48 +01:00