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
50371ee5
Commit
50371ee5
authored
Mar 06, 2017
by
Eric Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow masquerade on progress page
parent
dabda5ca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
4 deletions
+43
-4
lms/djangoapps/courseware/tests/test_masquerade.py
+37
-0
lms/djangoapps/courseware/views/views.py
+5
-3
lms/templates/courseware/course_navigation.html
+1
-1
No files found.
lms/djangoapps/courseware/tests/test_masquerade.py
View file @
50371ee5
...
...
@@ -107,6 +107,18 @@ class MasqueradeTestCase(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
)
return
self
.
client
.
get
(
url
)
def
get_progress_page
(
self
):
"""
Returns the server response for progress page.
"""
url
=
reverse
(
'progress'
,
kwargs
=
{
'course_id'
:
unicode
(
self
.
course
.
id
),
}
)
return
self
.
client
.
get
(
url
)
def
verify_staff_debug_present
(
self
,
staff_debug_expected
):
"""
Verifies that the staff debug control visibility is as expected (for staff only).
...
...
@@ -381,6 +393,31 @@ class TestStaffMasqueradeAsSpecificStudent(StaffMasqueradeTestCase, ProblemSubmi
content
=
self
.
get_course_info_page
()
.
content
self
.
assertIn
(
"OOGIE BLOOGIE"
,
content
)
def
test_masquerade_as_specific_student_progress
(
self
):
"""
Test masquesrading as a specific user for progress page.
"""
# Give the student some correct answers, check their progress page
self
.
login_student
()
self
.
submit_answer
(
'Correct'
,
'Correct'
)
student_progress
=
self
.
get_progress_page
()
.
content
self
.
assertNotIn
(
"1 of 2 possible points"
,
student_progress
)
self
.
assertIn
(
"2 of 2 possible points"
,
student_progress
)
# Staff answers are slightly different
self
.
login_staff
()
self
.
submit_answer
(
'Incorrect'
,
'Correct'
)
staff_progress
=
self
.
get_progress_page
()
.
content
self
.
assertNotIn
(
"2 of 2 possible points"
,
staff_progress
)
self
.
assertIn
(
"1 of 2 possible points"
,
staff_progress
)
# Should now see the student's scores
self
.
update_masquerade
(
role
=
'student'
,
user_name
=
self
.
student_user
.
username
)
masquerade_progress
=
self
.
get_progress_page
()
.
content
self
.
assertNotIn
(
"1 of 2 possible points"
,
masquerade_progress
)
self
.
assertIn
(
"2 of 2 possible points"
,
masquerade_progress
)
self
.
verify_real_user_profile_link
()
@attr
(
shard
=
1
)
class
TestGetMasqueradingGroupId
(
StaffMasqueradeTestCase
):
...
...
lms/djangoapps/courseware/views/views.py
View file @
50371ee5
...
...
@@ -828,9 +828,10 @@ def _progress(request, course_key, student_id):
staff_access
=
bool
(
has_access
(
request
.
user
,
'staff'
,
course
))
masquerade
=
None
if
student_id
is
None
or
student_id
==
request
.
user
.
id
:
#
always allowed to see your own profile
student
=
request
.
user
#
This will be a no-op for non-staff users, returning request.user
masquerade
,
student
=
setup_masquerade
(
request
,
course_key
,
staff_access
,
reset_masquerade_data
=
True
)
else
:
try
:
coach_access
=
has_ccx_coach_role
(
request
.
user
,
course_key
)
...
...
@@ -871,7 +872,8 @@ def _progress(request, course_key, student_id):
'student'
:
student
,
'passed'
:
is_course_passed
(
course
,
grade_summary
),
'credit_course_requirements'
:
_credit_course_requirements
(
course_key
,
student
),
'certificate_data'
:
_get_cert_data
(
student
,
course
,
course_key
,
is_active
,
enrollment_mode
)
'certificate_data'
:
_get_cert_data
(
student
,
course
,
course_key
,
is_active
,
enrollment_mode
),
'masquerade'
:
masquerade
}
with
outer_atomic
():
...
...
lms/templates/courseware/course_navigation.html
View file @
50371ee5
...
...
@@ -20,7 +20,7 @@ if active_page is None and active_page_context is not UNDEFINED:
def
selected
(
is_selected
)
:
return
"
selected
"
if
is_selected
else
""
show_preview_menu =
not
disable_preview_menu
and
staff_access
and
active_page
in
["
courseware
",
"
info
"]
show_preview_menu =
not
disable_preview_menu
and
staff_access
and
active_page
in
["
courseware
",
"
info
"
,
"
progress
"
]
cohorted_user_partition =
get_cohorted_user_partition(course)
masquerade_user_name =
masquerade.user_name
if
masquerade
else
None
masquerade_group_id =
masquerade.group_id
if
masquerade
else
None
...
...
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