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
f1dc6ecf
Commit
f1dc6ecf
authored
Sep 02, 2013
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add course setings for client key, secret
parent
b1d40b0f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
7 deletions
+29
-7
common/lib/xmodule/xmodule/course_module.py
+1
-0
common/lib/xmodule/xmodule/lti_module.py
+28
-7
No files found.
common/lib/xmodule/xmodule/course_module.py
View file @
f1dc6ecf
...
...
@@ -153,6 +153,7 @@ class TextbookList(List):
class
CourseFields
(
object
):
LTIs
=
List
(
help
=
"LTI tools passports as id:client_key:client_secret"
,
scope
=
Scope
.
settings
)
textbooks
=
TextbookList
(
help
=
"List of pairs of (title, url) for textbooks used in this course"
,
default
=
[],
scope
=
Scope
.
content
)
wiki_slug
=
String
(
help
=
"Slug that points to the wiki for this course"
,
scope
=
Scope
.
content
)
...
...
common/lib/xmodule/xmodule/lti_module.py
View file @
f1dc6ecf
...
...
@@ -31,8 +31,9 @@ class LTIFields(object):
and Scope.content (shared across all uses of this content in any course)
becomes much more clear/necessary."
"""
client_key
=
String
(
help
=
"Client key"
,
default
=
''
,
scope
=
Scope
.
settings
)
client_secret
=
String
(
help
=
"Client secret"
,
default
=
''
,
scope
=
Scope
.
settings
)
# client_key = String(help="Client key", default='', scope=Scope.settings)
# client_secret = String(help="Client secret", default='', scope=Scope.settings)
lti_id
=
String
(
help
=
"Id of the tool"
,
default
=
''
,
scope
=
Scope
.
settings
)
launch_url
=
String
(
help
=
"URL of the tool"
,
default
=
''
,
scope
=
Scope
.
settings
)
custom_parameters
=
List
(
help
=
"Custom parameters"
,
scope
=
Scope
.
settings
)
...
...
@@ -46,7 +47,23 @@ class LTIModule(LTIFields, XModule):
def
get_html
(
self
):
""" Renders parameters to template. """
import
ipdb
;
ipdb
.
set_trace
()
# get client_key and client_secret parameters from current course:
# course location example: u'i4x://blades/1/course/2013_Spring'
course
=
self
.
descriptor
.
system
.
load_item
(
self
.
location
.
tag
+
'://'
+
self
.
location
.
org
+
'/'
+
self
.
location
.
course
+
'/course'
+
'/2013_Spring'
)
client_key
,
client_secret
=
''
,
''
for
lti_passport
in
course
.
LTIs
:
try
:
lti_id
,
key
,
secret
=
lti_passport
.
split
(
':'
)
except
ValueError
:
raise
Exception
(
'Could not parse LTI passport: {0}.
\
Should be "id:key:secret" string.'
.
format
(
lti_passport
))
if
lti_id
==
self
.
lti_id
:
client_key
,
client_secret
=
key
,
secret
break
# these params do not participate in oauth signing
params
=
{
'launch_url'
:
self
.
launch_url
,
...
...
@@ -68,14 +85,18 @@ class LTIModule(LTIFields, XModule):
)
params
.
update
({
'custom_parameters'
:
parsed_custom_parameters
})
params
.
update
(
self
.
oauth_params
(
parsed_custom_parameters
))
params
.
update
(
self
.
oauth_params
(
parsed_custom_parameters
,
client_key
,
client_secret
))
return
self
.
system
.
render_template
(
'lti.html'
,
params
)
def
oauth_params
(
self
,
custom_parameters
):
def
oauth_params
(
self
,
custom_parameters
,
client_key
,
client_secret
):
"""Obtains LTI html from provider"""
client
=
requests
.
auth
.
Client
(
client_key
=
unicode
(
self
.
client_key
),
client_secret
=
unicode
(
self
.
client_secret
)
client_key
=
unicode
(
client_key
),
client_secret
=
unicode
(
client_secret
)
)
# @ned - why self.runtime.anonymous_student_id is None in dev env?
...
...
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