Commit Graph

132 Commits

Author SHA1 Message Date
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
bmedx
c125ff6a57 Remove unused pytest markers for Django 1.11 upgrade 2018-06-06 09:58:38 -04:00
Kabir Khan
c0f353467e V1 Grades API with added support for bulk read of all user grades in a course.
URL patterns changed to follow edx API conventions
2018-05-03 10:23:33 -07:00
Eric Fischer
e18448e27d Silence deprecation warnings
https://docs.djangoproject.com/en/1.11/releases/1.10/#using-user-is-authenticated-and-user-is-anonymous-as-methods
2018-05-02 10:03:50 -04:00
Waheed Ahmed
20e7a15ac6 Fix enabling debug allows api access without authentication.
LEARNER-1220
2018-04-04 12:54:52 +05: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
Jeremy Bowman
5289c7e828 PLAT-1915 Stop using deprecated BaseException.message 2018-01-31 17:22:01 -05:00
John Eskew
875a127f84 Pylint fixes to move number below allowed threshold. 2018-01-25 11:38:37 -05:00
Nimisha Asthagiri
bb738571ce Merge pull request #17093 from edx/arch/django-app-plugin
Django App Plugins
2018-01-11 15:49:45 -05:00
Jeremy Bowman
1a7753d775 PLAT-1881 Fix datetimes lacking timezone information 2018-01-10 14:33:01 -05:00
Nimisha Asthagiri
a37d09aefb Move PluginManager out of api folder 2018-01-08 19:15:23 -05:00
bmedx
f7a36aae64 Small fixes to LMS unit 2 failures in Django 1.11 tests 2018-01-05 10:41:07 -05:00
Eric Fischer
8743cda0d6 Zendesk Proxy
This change creates a new lms/cms endpoint which accepts unauthenticated
requests to securely create zendesk tickets. This allows javascript code to
create tickets without exposing ZENDESK_OAUTH_ACCESS_TOKEN

EDUCATOR-1889
2017-12-06 13:32:44 -05:00