Commit Graph

144 Commits

Author SHA1 Message Date
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
Tim McCormack
f29e418264 Revert "Revert "ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)" (#25025)" (#25055)
This reverts commit 986a448d9e.
2020-09-28 13:53:57 +00:00
Ahtisham Shahid
986a448d9e Revert "ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)" (#25025)
This reverts commit ba9ee4e151.

Fixed Style lint issue
2020-09-21 13:48:00 +05:00
Tim McCormack
ba9ee4e151 ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)
This uses the new names introduced in edx-django-utils
3.8.0 (edx/edx-django-utils#59), which we're already using, as
well as updating a few other locations where we incorrectly refer
to New Relic custom metrics instead of custom attributes.

Includes a couple of unrelated lint fixes in a file I modified.
2020-09-18 13:33:50 +00:00
adeelehsan
4e1fe2045f Specify bio message for user
Currently user message is generic. Specifying for
bio field so that it make more sense to user.

PROD-1582
2020-06-10 14:19:39 +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
Robert Raposa
372d2e927c BOM-1264: add third-party-auth scope and usage (#23135)
* WIP: add third-party-auth scope and usage

BOM-1264


* Fix tests now that we do permissions in a more standard way.

Rather than manually setting the permission class we previously
explicitly raised a PermissionDenied exception.  The way DRF
permissoning logic works, if we use the WWW-Authenticate header in the
highest priority auth class, it will return a 401 instead of a 403.


* Added test to make sure having permissions gives access to user mapping api

* Test new filters logic.

Ensure that the filters we add to the application access model make it
into the JWT correctly.

* quality fix

* quality fix

* disable pylint warning

* quality fix

* fix indent prob

Co-authored-by: Feanil Patel <feanil@edx.org>
Co-authored-by: Manjinder Singh <49171515+jinder1s@users.noreply.github.com>
2020-02-21 11:25:28 -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
Manjinder Singh
eb694528e7 Adding metrics to oauth2authentication class (#22970)
Currently, we are working on removing the rest_framework_auth library from edx-platform. For this push, we need to remove the oauth2Authentication class. This PR creates a new class oauth2AuthenticationDeprecated that adds additional new relic metrics. The metrics would allow us to see how often this class is used and its success rate. The hope is that this information will help us with transitioning to a different authentication class.
2020-01-30 09:13:51 -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
Diana Huang
976c6873e5 Upgrade DRF to latest version. 2020-01-02 12:18:03 -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
Diana Huang
6fb40586fb Move LoginSessionView from user_api to user_authn 2019-11-01 08:19:55 -04:00
aarif
d176957708 Updated the tests to fix the string/bytes input
changes made to pass tests with python 2 and other minor changes

Updated the tests to fix the string/bytes input

changes made to pass tests with python 2 and other minor changes

made some changes as suggested

made changes as suggested

changes made as suggested
2019-10-14 18:47:18 +05:00
Awais Qureshi
ae9dcdef8a BOM-917
Fix encoding issue.
2019-10-11 20:12:34 +05:00
jinder1s
2c6b2f32dd converting unicode to byte where necessary 2019-10-04 11:13:11 -04:00
jinder1s
3dc35dc09c Explicity creating byte strings 2019-10-01 13:43:45 -04:00
Ayub khan
8a95a8e520 BOM-95
assertItemsEqual with six.assertCountEqual
2019-08-21 17:01:40 +05: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
Michael Roytman
77dc0fa9f0 add number of total users and number of filtered users to the gradebook API 2019-07-24 23:02:04 -04:00
usama sadiq
7a5f0b7d24 Pylint Warning Supression Removed 2019-06-27 12:15:06 +05:00
Alex Dusenbery
403fb52e93 Add a GET endpoint to list ProgramCourseEnrollment data. 2019-05-03 13:39:10 -04:00
Alex Dusenbery
20f0bc03d4 Add a GET API endpoint for program enrollments. 2019-05-01 11:35:38 -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
Calen Pennington
78c8950ea3 Clean up a few remaining unicode format string errors 2019-02-20 15:28:14 -05:00
Matthew Piatetsky
444799fb0e fix unicode strings in openedx/ part 2 2019-02-15 10:15:51 -05:00
Michael Youngstrom
4bbd1dee0b Remove shards from commonlib-unit tests 2019-02-12 14:28:35 -05:00
Calen Pennington
6c596f7c49 Allow courses api to return data incrementally
Prior to this commit, the course api (/api/courses/v1/courses/)
performed all the work necessary to return all courses available
to the user, and then only actually returned on page's worth of those
courses.

With this change, the api now does the work incrementally, computing
only the data needed to fetch the courses up to and including the page
being returned. This still increases approximately linearly as
the page number accessed being increases, but should be more cache-friendly.
One side effect of this is that the max_page reported by pagination
will be an overestimate (it will include pages that are removed due
to a users access restrictions).

This change also changes the sort-order of courses being returned by the
course_api. By sorting by course-id, rather than course-number, we
can sort in the database, rather than in Python, and defer loading data
from the end of the list until it is requested.

REVMI-90
2019-02-06 10:11:15 -05:00
Calen Pennington
805f32a357 Revert "Allow courses api to return data incrementally" 2019-01-25 12:56:57 -05:00
Calen Pennington
a3541d6e46 Allow courses api to return data incrementally
Prior to this commit, the course api (/api/courses/v1/courses/)
performed all the work necessary to return all courses available
to the user, and then only actually returned on page's worth of those
courses.

With this change, the api now does the work incrementally, computing
only the data needed to fetch the courses up to and including the page
being returned. This still increases approximately linearly as
the page number accessed being increases, but should be more cache-friendly.
One side effect of this is that the max_page reported by pagination
will be an overestimate (it will include pages that are removed due
to a users access restrictions).

This change also changes the sort-order of courses being returned by the
course_api. By sorting by course-id, rather than course-number, we
can sort in the database, rather than in Python, and defer loading data
from the end of the list until it is requested.

REVMI-90
2019-01-25 10:30:09 -05:00
Ned Batchelder
3353e7425e Remove unused imports 2018-11-03 16:07:05 -04:00
Robert Raposa
fbc59231fc Update edx-drf-extensions to 2.0.0.
Note: this version update is backward incompatible.

ARCH-255
2018-10-17 01:00:34 -04:00
Ahsan Ulhaq
ee7555e85f update usage of SessionAuthenticationAllowInactiveUser
LEARNER-6469
2018-10-01 17:52:52 +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
Nimisha Asthagiri
ce4cb53672 Update Permissions to use latest edx-drf-extensions and rest_condition 2018-06-28 18:37:53 -04:00
Nimisha Asthagiri
8db2dd47dd Course Validation and Course Quality APIs 2018-06-13 20:33:45 -04:00