Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
0401c602
Commit
0401c602
authored
Feb 29, 2016
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hacky but working studio integration 1
parent
46533015
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
1 deletions
+66
-1
common/lib/xmodule/xmodule/html_module.py
+3
-0
lms/djangoapps/courseware/module_render.py
+63
-1
No files found.
common/lib/xmodule/xmodule/html_module.py
View file @
0401c602
...
@@ -323,6 +323,9 @@ class HtmlDescriptor(HtmlBlock, XmlDescriptor, EditingDescriptor): # pylint: di
...
@@ -323,6 +323,9 @@ class HtmlDescriptor(HtmlBlock, XmlDescriptor, EditingDescriptor): # pylint: di
else
:
else
:
xblock_body
[
"content"
]
=
html_body
xblock_body
[
"content"
]
=
html_body
xblock_body
[
"content_type"
]
=
"Text"
xblock_body
[
"content_type"
]
=
"Text"
print
xblock_body
return
xblock_body
return
xblock_body
...
...
lms/djangoapps/courseware/module_render.py
View file @
0401c602
...
@@ -886,6 +886,56 @@ def handle_xblock_callback_noauth(request, course_id, usage_id, handler, suffix=
...
@@ -886,6 +886,56 @@ def handle_xblock_callback_noauth(request, course_id, usage_id, handler, suffix=
return
_invoke_xblock_handler
(
request
,
course_id
,
usage_id
,
handler
,
suffix
,
course
=
course
)
return
_invoke_xblock_handler
(
request
,
course_id
,
usage_id
,
handler
,
suffix
,
course
=
course
)
PRIVATE_KEY
=
"""-----BEGIN RSA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9EZpvNUgbzbtr8CgYAOl5xZK0Y59TQyI6J50zpr
f2Q8mR5CFxkewwqmTtE+zXvWYx5l8qC5v+9tdmFuSY9M6h4s+hEU59fCezT0mZ9N
yFH8/sjFbn5lW2P8wacv4bJzjj/0JD4dJ9IKQjUH0emHXqs2vX2MuYD5KBzBo8jm
fYjnFlEIMP/RByf6wfC8QQKBgE1c5yc4LvN/s4a4lOcyweel8WiXZ6Q8F+ylRR6c
+TimsH/l91RqgnfjVeBzb0I84epgHNihLdsCQhnR+WD4USR4bEd8nE0LzN71pkVP
dpPXJY9NkhcdCD9uKofAdioNaHh87xKlR+ZZls9iGbHo4oolHKJsSaxDLPvbhoBf
4oBRAoGAU3qOKBKzGXmolVe4MvOySpB8hGXVclJxiTcmd2ceMNPcFFVJLFZkoEB9
hoMr2QXhi6qWs3wOltM0qCtkWaVXf6hLIIbzH39DJAURawWU+jBVBigKpKNZDNg3
bcpGqkph8suIl0uV6IAo1NitfpOcMfHR2+4dLUvVZg+zrF8eyoI=
-----END RSA PRIVATE KEY-----"""
PUBLIC_KEY
=
(
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGp6wC9PlYGr+pdYp5vO0PleYmpRkzgQ"
"ijzm2+Xy/jSo9jWrvLa5EbgnWqRoHKjC3MvlXZDQFPXMPuI6wx8grXJjaQOeQAxE1K24RN"
"uxi1H2zESo+UgFuLXvtU12n5erWwwkpqFUcwL5Ytj0hX6kC34NcSWA+/fEvBIAfMPvgCB1"
"UV8fVIWAekS10otq1rF+6jXnRwS7WUTyrujfanMxyVqU6cmG1rE65NoloqgToCZWr3W2Zy"
"w+9yzoqeOlgTPXSSxL7yeDrWvE6wTrxCVeZT7Km3wo8b93J4f9AZRz+MZR3RFGZY1J7Ncy"
"8Rx+85IuuPYzmPnWXPINARV4RFA6JJ dormsbee@Daves-MBP"
)
import
jwt
class
AuthService
(
object
):
def
encode_token
(
self
,
data
):
return
jwt
.
encode
(
data
,
PRIVATE_KEY
,
algorithm
=
'RS512'
)
def
decode_token
(
self
,
token
):
return
jwt
.
decode
(
token
,
PUBLIC_KEY
,
algorithms
=
[
'RS512'
,
'RS384'
,
'RS256'
])
def
handle_xblock_callback
(
request
,
course_id
,
usage_id
,
handler
,
suffix
=
None
):
def
handle_xblock_callback
(
request
,
course_id
,
usage_id
,
handler
,
suffix
=
None
):
"""
"""
Generic view for extensions. This is where AJAX calls go.
Generic view for extensions. This is where AJAX calls go.
...
@@ -901,7 +951,14 @@ def handle_xblock_callback(request, course_id, usage_id, handler, suffix=None):
...
@@ -901,7 +951,14 @@ def handle_xblock_callback(request, course_id, usage_id, handler, suffix=None):
not accessible by the user, or the module raises NotFoundError. If the
not accessible by the user, or the module raises NotFoundError. If the
module raises any other error, it will escape this function.
module raises any other error, it will escape this function.
"""
"""
if
not
request
.
user
.
is_authenticated
():
# Many things wrong here -- should check JWT, should pass in header, should
# have better name
xblock_auth_token
=
request
.
GET
.
get
(
'auth_token'
)
print
"TOKEN: {}"
.
format
(
xblock_auth_token
)
print
"Whole Request GET: {}"
.
format
(
request
.
GET
)
if
not
request
.
user
.
is_authenticated
()
and
not
xblock_auth_token
:
return
HttpResponse
(
'Unauthenticated'
,
status
=
403
)
return
HttpResponse
(
'Unauthenticated'
,
status
=
403
)
try
:
try
:
...
@@ -909,6 +966,11 @@ def handle_xblock_callback(request, course_id, usage_id, handler, suffix=None):
...
@@ -909,6 +966,11 @@ def handle_xblock_callback(request, course_id, usage_id, handler, suffix=None):
except
InvalidKeyError
:
except
InvalidKeyError
:
raise
Http404
(
"Invalid location"
)
raise
Http404
(
"Invalid location"
)
if
xblock_auth_token
:
auth_svc
=
AuthService
()
auth_info
=
auth_svc
.
decode_token
(
xblock_auth_token
)
request
.
user
=
User
.
objects
.
get
(
username
=
auth_info
[
'u'
])
with
modulestore
()
.
bulk_operations
(
course_key
):
with
modulestore
()
.
bulk_operations
(
course_key
):
try
:
try
:
course
=
modulestore
()
.
get_course
(
course_key
)
course
=
modulestore
()
.
get_course
(
course_key
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment