Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
5b89c2f5
Unverified
Commit
5b89c2f5
authored
6 years ago
by
Gabe Mulley
Browse files
Options
Downloads
Patches
Plain Diff
support cross domain ajax requests to the experiments APIs
parent
6cc13f7f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lms/djangoapps/experiments/views.py
+8
-2
8 additions, 2 deletions
lms/djangoapps/experiments/views.py
with
8 additions
and
2 deletions
lms/djangoapps/experiments/views.py
+
8
−
2
View file @
5b89c2f5
...
...
@@ -10,12 +10,18 @@ from experiments import filters, serializers
from
experiments.models
import
ExperimentData
,
ExperimentKeyValue
from
experiments.permissions
import
IsStaffOrOwner
,
IsStaffOrReadOnly
from
openedx.core.lib.api.authentication
import
SessionAuthenticationAllowInactiveUser
from
openedx.core.djangoapps.cors_csrf.authentication
import
SessionAuthenticationCrossDomainCsrf
User
=
get_user_model
()
# pylint: disable=invalid-name
class
ExperimentCrossDomainSessionAuth
(
SessionAuthenticationAllowInactiveUser
,
SessionAuthenticationCrossDomainCsrf
):
"""
Session authentication that allows inactive users and cross-domain requests.
"""
pass
class
ExperimentDataViewSet
(
viewsets
.
ModelViewSet
):
authentication_classes
=
(
JwtAuthentication
,
SessionAuthenticationAllowInactiveUser
,)
authentication_classes
=
(
JwtAuthentication
,
ExperimentCrossDomainSessionAuth
,)
filter_backends
=
(
DjangoFilterBackend
,)
filter_class
=
filters
.
ExperimentDataFilter
permission_classes
=
(
permissions
.
IsAuthenticated
,
IsStaffOrOwner
,)
...
...
@@ -83,7 +89,7 @@ class ExperimentDataViewSet(viewsets.ModelViewSet):
class
ExperimentKeyValueViewSet
(
viewsets
.
ModelViewSet
):
authentication_classes
=
(
JwtAuthentication
,
SessionAuthenticationAllowInactiveUser
,)
authentication_classes
=
(
JwtAuthentication
,
ExperimentCrossDomainSessionAuth
,)
filter_backends
=
(
DjangoFilterBackend
,)
filter_class
=
filters
.
ExperimentKeyValueFilter
permission_classes
=
(
IsStaffOrReadOnly
,)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment