File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1515from .grades import UserCurrentGrades
1616from .user_info import UserInfo
1717from .user_validation import UserValidation
18+ from .lti_tools import LTITools
1819
1920
2021class EdxApi :
@@ -123,3 +124,9 @@ def user_validation(self):
123124 def course_runs (self ):
124125 """Course runs management API (Works with CMS)"""
125126 return CourseRuns (self .get_requester (token_type = "jwt" ), self .base_url )
127+
128+ @property
129+ def lti_tools (self ):
130+ """LTI Tools API"""
131+ return LTITools (self .get_requester (), self .base_url )
132+
Original file line number Diff line number Diff line change 1+ """Client for user_validation API"""
2+ from urllib .parse import urljoin
3+
4+
5+ class LTITools :
6+ """
7+ Open edX user validation client
8+ """
9+
10+ def __init__ (self , requester , base_url ):
11+ """
12+ Args:
13+ requester (Requester): an authenticated objects for requests to edX
14+ base_url (str): string representing the base URL of an edX LMS instance
15+ """
16+ self .requester = requester
17+ self .base_url = base_url
18+
19+
20+ def fix_lti_user (self , username , email ):
21+ """
22+ Fixes an LTI user with duplicate email
23+
24+ Args:
25+ username (str): Username of the Application user
26+ email (str): Email of the Application user
27+
28+ Returns:
29+ bool: True if the user was fixed successfully, False otherwise
30+ """
31+ request_data = dict (username = username , email = email )
32+
33+ # the request is done on behalf of the current logged in user
34+ return self .requester .post (
35+ urljoin (
36+ self .base_url ,
37+ '/api/lti-user-fix/'
38+ ),
39+ json = request_data )
You can’t perform that action at this time.
0 commit comments