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
3fe35770
Commit
3fe35770
authored
Jul 07, 2013
by
ichuang
Committed by
Justin Riley
Jun 09, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add http basic auth to proctor panel interface
parent
ca4ca008
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
26 deletions
+40
-26
common/lib/xmodule/xmodule/proctor_module.py
+16
-6
lms/templates/proctor_release.html
+24
-20
No files found.
common/lib/xmodule/xmodule/proctor_module.py
View file @
3fe35770
...
@@ -19,11 +19,21 @@ log = logging.getLogger('mitx.' + __name__)
...
@@ -19,11 +19,21 @@ log = logging.getLogger('mitx.' + __name__)
class
ProctorPanel
(
object
):
class
ProctorPanel
(
object
):
'''
'''
Interface to proctor panel system, which determines if a given proctored item
Interface to proctor panel system, which determines if a given proctored item
(specified by its procset_name) is released to a given student (specified by the
(specified by its procset_name) is released to a given student.
user_id).
The LMS configuration should come with a dict which specifies the proctor panel
server information, eg:
PROCTOR_PANEL_INTERFACE = {
'url' : "http://192.168.42.6",
'username' : 'lms',
'password' : 'abcd',
}
'''
'''
ProctorPanelServer
=
getattr
(
settings
,
'PROCTOR_PANEL_SERVER_URL'
,
'https://proctor.mitx.mit.edu'
)
ProctorPanelInterface
=
getattr
(
settings
,
'PROCTOR_PANEL_INTERFACE'
,
{})
ProctorPanelServer
=
ProctorPanelInterface
.
get
(
'url'
,
""
)
def
__init__
(
self
,
user_id
,
procset_name
):
def
__init__
(
self
,
user_id
,
procset_name
):
...
@@ -36,7 +46,8 @@ class ProctorPanel(object):
...
@@ -36,7 +46,8 @@ class ProctorPanel(object):
url
=
'{2}/cmd/status/{0}/{1}'
.
format
(
self
.
user_id
,
self
.
procset_name
,
self
.
ProctorPanelServer
)
url
=
'{2}/cmd/status/{0}/{1}'
.
format
(
self
.
user_id
,
self
.
procset_name
,
self
.
ProctorPanelServer
)
log
.
info
(
'ProctorPanel url={0}'
.
format
(
url
))
log
.
info
(
'ProctorPanel url={0}'
.
format
(
url
))
#ret = self.ses.post(url, data={'userid' : self.user_id, 'urlname': self.procset_name}, verify=False)
#ret = self.ses.post(url, data={'userid' : self.user_id, 'urlname': self.procset_name}, verify=False)
ret
=
self
.
ses
.
get
(
url
,
verify
=
False
)
auth
=
(
self
.
ProctorPanelInterface
.
get
(
'username'
),
self
.
ProctorPanelInterface
.
get
(
'password'
))
ret
=
self
.
ses
.
get
(
url
,
verify
=
False
,
auth
=
auth
)
try
:
try
:
retdat
=
json
.
loads
(
ret
.
content
)
retdat
=
json
.
loads
(
ret
.
content
)
except
Exception
as
err
:
except
Exception
as
err
:
...
@@ -49,7 +60,6 @@ class ProctorPanel(object):
...
@@ -49,7 +60,6 @@ class ProctorPanel(object):
class
ProctorFields
(
object
):
class
ProctorFields
(
object
):
username
=
String
(
help
=
"username of student"
,
scope
=
Scope
.
user_state
)
procset_name
=
String
(
help
=
"Name of this proctored set"
,
scope
=
Scope
.
settings
)
procset_name
=
String
(
help
=
"Name of this proctored set"
,
scope
=
Scope
.
settings
)
...
@@ -66,7 +76,7 @@ class ProctorModule(ProctorFields, XModule):
...
@@ -66,7 +76,7 @@ class ProctorModule(ProctorFields, XModule):
runs out, exam access closes.
runs out, exam access closes.
Example:
Example:
<proctor procset_name="
proctorset
1">
<proctor procset_name="
Proctored Exam
1">
<sequential url_name="exam1" />
<sequential url_name="exam1" />
</proctor>
</proctor>
...
...
lms/templates/proctor_release.html
View file @
3fe35770
...
@@ -24,8 +24,27 @@ procrel = (function(){
...
@@ -24,8 +24,27 @@ procrel = (function(){
statel
.
html
(
'<font color="green">'
+
status
+
'</font>'
);
statel
.
html
(
'<font color="green">'
+
status
+
'</font>'
);
}
}
var
do_pp_get
=
function
(
cmd
,
gfun
){
$
.
ajax
({
url
:
mkurl
(
cmd
),
type
:
'GET'
,
data
:
{
"uname"
:
"${pp.user.username}"
,
"name"
:
"${pp.user.profile.name}"
},
xhrFields
:
{
withCredentials
:
true
},
username
:
"${pp.ProctorPanelInterface.get('username')}"
,
password
:
"${pp.ProctorPanelInterface.get('password')}"
,
success
:
gfun
,
dataType
:
"json"
,
error
:
function
(
xhr
,
status
,
error
)
{
alert
(
'Error: cannot connect to server'
+
status
+
"error:"
+
error
);
}
});
}
var
check_access
=
function
(){
var
check_access
=
function
(){
$
.
get
(
mkurl
(
'status'
)
,
function
(
data
){
do_pp_get
(
'status'
,
function
(
data
){
console
.
log
(
data
);
console
.
log
(
data
);
if
(
data
.
enabled
)
{
if
(
data
.
enabled
)
{
alert
(
"Access Granted!"
);
alert
(
"Access Granted!"
);
...
@@ -46,31 +65,15 @@ procrel = (function(){
...
@@ -46,31 +65,15 @@ procrel = (function(){
var
make_request
=
function
(){
var
make_request
=
function
(){
check_count
=
0
;
check_count
=
0
;
do_pp_get
(
'request'
,
function
(
result
,
status
,
xhr
){
$
.
ajax
({
url
:
mkurl
(
'request'
),
type
:
'GET'
,
data
:
{
"uname"
:
"${pp.user.username}"
,
"name"
:
"${pp.user.profile.name}"
},
success
:
function
(
result
,
status
,
xhr
){
//setstat(result.status);
setstat
(
result
.
status
);
setstat
(
result
.
status
);
//alert(result);
// location.reload();
periodic_check
();
periodic_check
();
},
});
//dataType: "text",
dataType
:
"json"
,
// crossDomain: true,
error
:
function
(
xhr
,
status
,
error
)
{
alert
(
'Error: cannot connect to server'
+
status
+
"error:"
+
error
);
}
});
}
}
el
.
click
(
make_request
);
el
.
click
(
make_request
);
return
{
"check"
:
check_access
,
"make"
:
make_request
,
"mkurl"
:
mkurl
};
return
{
"check"
:
check_access
,
"make"
:
make_request
,
"mkurl"
:
mkurl
,
"do_pp_get"
:
do_pp_get
};
}()
);
}()
);
</script>
</script>
\ No newline at end of file
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