69 Commits

Author SHA1 Message Date
Feanil Patel
92a47097b7 feat: Drop the ENABLE_OAUTH2_PROVIDER flag.
This setting was not actually not changing installation behavior, that
is being set by whether oauth_dispatch is in INSTALLED_APPS or not.

This flag was being used to:

* Hide enable/disable certain URL paths.
    * We need these paths on all the time in the LMS because all other
      services and MFE rely on oauth to authenticate with the LMS so we
      just end up turning this on later in the settings stack.

* We use it to only run certain oauth_dispatch tests in the LMS test
  environment because the oauth_dispatch app is not installed in the
  CMS.
    * We use the `skip_unless_lms` decorator now instead to do this or
      just run the tests in both suites because they are valid tests in
      both contexts.
2025-11-03 12:54:06 -05:00
Mohammad Ahtasham ul Hassan
dd488a76d1 fix: fixed django40 warnings (#29641)
* fix: fixed django4 warnings
Co-authored-by: UsamaSadiq <usama.sadiq@arbisoft.com>
2022-02-25 16:24:51 +05:00
Jawayria
dba7d78c74 chore: Applied lint-amnesty on openedx/core/lib 2021-12-02 15:11:13 +05:00
Maria Grimaldi
2ee52ea96c refactor: replace some create_user with UserFactory to avoid non-existent profile errors 2021-08-24 15:49:21 -04:00
Kshitij Sobti
d2c2fcdefe feat: Course Apps API [BD-38] [TNL-8103] [BB-2716] (#27542)
* feat: Course Apps API

This adds a new concept called course apps. These are exposed via a new
"openedx.course_app" entrypoint, which helps the LMS and studio discover such
apps and list them in a new rest api for the same.

These course apps will drive the pages and resources view in the course authoring
MFE. This system will track which apps are enabled and which are disabled. It
also allows third-party apps to be listed here by using the plugin entrypoint.

* Apply feedback from review
2021-06-23 21:51:12 +05:00
Jawayria
953f1fa05c Merge pull request #26615 from edx/jawayria/bom-2408-7
BOM-2408: Removed unused imports from openedx/core/{djangolib, lib} a…
2021-04-12 14:45:52 +05:00
Usama Sadiq
068ac5290f refactor: Ran pyupgrade on openedx/core
Ran pyupgrade on openedx/core/{lib, tests}
2021-04-08 18:34:38 +05:00
Jawayria
4cdf466215 refactor: Removed unused imports
Removed unused imports from openedx/core/{djangolib, lib} and openedx/{tests, features}
2021-04-06 17:24:04 +05:00
Aarif
813064ad49 replaced unittest assertions pytest assertions (#26574) 2021-02-22 20:04:51 +05:00
Jawayria
9909b933a7 Applied pylint-amnesty to openedx/core/{djangolib, lib, tests, *.py 2021-02-02 21:13:24 +05:00
Ahtisham Shahid
b2466c8c2b Error incase of disabled user social login
Updated status code and manage user func

update auth verification

Fixed auth condition

fixed test failuers

fixed style issues

fixed style issues

Created test for auth disabled use

Code refactor

Fixed form ain auth exchange

Fixed oauth apps with disabled user fail

applied quality fixes

Refactored tests

fixed quality issues

removed extra files

Fixed linter issues

Fixed linter issues
2021-01-06 20:37:01 +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
Robert Raposa
5de9eed420 ARCHBOM-1093: Fix unit test enable-migrations (#23789)
* fix old migrations
* fix a test
* fix enable-migrations cmd argument
* enhance verbose logging to log migrations
* update testing doc with help
2020-04-23 14:04:29 -04:00
Aarif
6ee2089077 fixed warnings for wrong-import-order 2020-04-08 23:43:06 +05:00
Manjinder Singh
d08cd9ce04 Removing provider imports from edx-platform (#23229)
* Removing from provider imports from openedx

 * removed all uses of retire_dop_oauth2_models

* Removing provider library from lms, common, and cms

Created/copied function short_token(from django-oauth-provider) and create_hash256 to help with conversion
2020-03-02 08:56:54 -05:00
jinder1s
295da79fe5 Remove DOP dispatching from oauth_dispatch.
https://openedx.atlassian.net/browse/BOM-1330
2020-02-27 10:47:06 -05:00
Manjinder Singh
d7bd80a100 Renamed OAuth2Authentication to BearerAuthentication (#23128)
* Renamed OAuth2Authentication to BearerAuthentication
* Added back OAuth2Authentication name
-there are libraries such as edx-enterprise that still import OAuth2Authentication.  The OAuth2Authentication class should be fully removed when everything is importing BearerAuthentication correctly
2020-02-18 13:29:29 -05:00
Manjinder Singh
cce8cdd661 Replacing OAuth2Auth (#23067)
- Removing deprecated auth classes
- Replacing OAuth2AuthenticationAllowInactiveUserDeprecated with OAuth2AuthenticationAllowInactiveUser
- the old class was a child class of a deprecated class that we are removing and replacing.
2020-02-11 10:38:13 -05:00
Manjinder Singh
cea795b02e Added new auth class (#23018)
* Added new auth class

- Created new class called OAuth2AuthenticationAllowInactiveUser, which replaces old class with same name
- Renames previous  OAuth2AuthenticationAllowInactiveUser to  OAuth2AuthenticationAllowInactiveUserDeprecated
- Replaced all imports of  OAuth2AuthenticationAllowInactiveUser to call deprecated class instead
- testing new class in discussion(added flag based on django setting)
2020-02-06 10:37:27 -05:00
Manjinder Singh
e0981025b2 changed oauth2 authentication class in bookmarks app (#22908)
* Added new authentication class(meets drf standards)

The new class replaces the deprecated oauth2authetnication class from rest_framework_auth library(repo django-rest-framework-oauth).
Majority of the code is combination of copy-pasta from old oauth2authentication class and Oauth2AuthenticationAllowInactiveUser class

* Added ability to switch to new authentication class in bookmarks app

* Changed error type reported by Outh class. It now outputs a json rather than a string.
2020-02-04 08:49:26 -05:00
Kyle McCormick
28c0433352 Reinstate "Remove CourseOverview.get_from_id[s]_if_exists (#22918)"
This reverts commit cdb0619846,
which itself reverted 3ca006214e.

The original commit (3ca006) was reverted because it was suspected
that it was causing unexpectedly-increased memcached usage and
500s in the Gradebook API. It is not clear whether that is actually
the case. We are optimistically reinstating 3ca006 and will monitor
production to see if there is an adverse effect.

MST-105
2020-01-27 11:17:06 -05:00
Kyle McCormick
cdb0619846 Revert "Remove CourseOverview.get_from_id[s]_if_exists (#22918)" (#22926)
This reverts commit 3ca006214e.
2020-01-23 13:52:11 -05:00
Kyle McCormick
3ca006214e Remove CourseOverview.get_from_id[s]_if_exists (#22918)
The functions `CourseOverview.get_from_id_if_exists`
and `CourseOverview.get_from_ids if exists` are bug-
prone, in that they do not go to the modulestore
when a CourseOverview is out-of-date or uncached.
The docstrings spell this out, but callers seem
not to understand the implications.

So, in this commit, we:
* Remove both functions
* Add `CourseOverview.get_from_ids` for almost-as-fast
  yet safer bulk-fetching of overviews
* Update call sites to use `course_exists` or `get_from_ids`
  in place of the old functions.
* Add tests for @verify_course_exists.
This PR should specifically fix an issue where
the program_enrollments API was breaking when the CourseOverview
version was bumped.

CR-1708
2020-01-23 09:41:55 -05:00
iamsobanjaved
38493d5092 Removed app_name warning from django.conf.urls.include() 2020-01-21 20:38:27 +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
jinder1s
3dc35dc09c Explicity creating byte strings 2019-10-01 13:43:45 -04:00
David Ormsbee
9a1385585f Convert response bytes to str before JSON parsing. (#21375)
Convert response bytes to str before JSON parsing.
2019-08-19 11:01:55 -04:00
Andrés González
26b3a40133 INCR-108 (#20058)
* INCR-108: Run python-modernize on openedx/core/lib

* Fixed urlencode import

* Fixed diff quality warnings and six.string_types error

* Fixed pickle import

* Fixed iteritems import

* Fixed ungrouped imports

* Fixed six.moves import issues
2019-04-02 10:26:00 -04:00
Michael Youngstrom
4bbd1dee0b Remove shards from commonlib-unit tests 2019-02-12 14:28:35 -05:00
Jeremy Bowman
3ff3eee2f2 TE-2689 Remove useless pylint suppressions part 4 2018-08-20 12:54:22 -04:00
Jeremy Bowman
c290bf8a07 TE-2524 Stop using nose.plugins - openedx 2018-08-02 14:54:50 -04:00
bmedx
c125ff6a57 Remove unused pytest markers for Django 1.11 upgrade 2018-06-06 09:58:38 -04:00
George Babey
26bac9f611 Moved paginators to edx_rest_framework_extensions package
Pagination should be standard and easy to adopt so moved the paginators
into the edx_rest_framework_extensions package so they can be easily
installed into other app/projects
2018-02-16 09:46:01 -05:00
John Eskew
875a127f84 Pylint fixes to move number below allowed threshold. 2018-01-25 11:38:37 -05:00
Jeremy Bowman
1a7753d775 PLAT-1881 Fix datetimes lacking timezone information 2018-01-10 14:33:01 -05:00
bmedx
f7a36aae64 Small fixes to LMS unit 2 failures in Django 1.11 tests 2018-01-05 10:41:07 -05:00
bmedx
d827d47b48 Tag LMS Unit 2 tests that fail in Django 1.11 2017-11-22 15:47:22 -05:00
bmedx
68e3894c17 openedx urls cleanup for Django 1.11
- Remove usage of django.urls.patterns
- Change urls tuples to lists
- Make all string view names callables
2017-11-03 16:11:41 -04:00
Troy Sankey
7f394cfce8 remove uses of django.util.unittest
django.util.unittest was deprecated in django 1.7 and removed in 1.9.

PLAT-1551
2017-10-03 11:51:28 -04:00
John Eskew
2cd62c7bfb Upgrade django-rest-framework version to edX fork, which is DRF v3.6.3
with a custom patch needed by edx-platform.
Upgrade django-filter as well to v1.0.4
Import DjangoFilterBackend from the correct module - django_filter.
Add django-filter to INSTALLED_APPS.
2017-07-14 16:05:13 -04:00
Marko Jevtic
8e33ec52b5 Address comments 2017-01-11 07:09:48 +00:00
Douglas Hall
b44864b353 Check API View kwargs for username when checking for staff or owner permission 2017-01-11 07:09:48 +00:00
chrisndodge
6d327594ac add restricted DOT OAUTH2 client with reduced privileges 2016-10-14 07:31:26 -04:00
Jesse Zoldak
8004545cf5 Revert "Cdodge/restricted oauth2 applications" 2016-10-13 13:18:29 -04:00
chrisndodge
1732663486 add restricted DOT OAUTH2 client with reduced privileges 2016-10-12 09:40:49 -04:00
Nimisha Asthagiri
4c0f85b4d9 Move auth_exchange from common to openedx/core.
Move oauth_dispatch from lms to openedx/core.
2016-10-06 12:54:39 -04:00
Calen Pennington
bc20a37c2b Simplify how shards are selected in CI 2016-08-03 16:23:02 -04:00
Clinton Blackburn
5a7bc01986 JWT authentication updates
- Using jwt_decode_handler from edx-drf-extensions
- Updated djangorestframework-jwt
- Removed feature flag around JWT auth

ECOM-4221
2016-04-20 16:25:25 -04:00
Clinton Blackburn
c921f2ac90 Merge pull request #12011 from edx/clintonb/course-api-image
Exposing absolute/CDN image URLs via Course API
2016-04-01 10:31:59 -04:00