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
e6a9047f
Commit
e6a9047f
authored
Jun 02, 2014
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3852 from edx/waheed/lms2737-fix-staff-debug-info-links
Fixed staff debug info endpoints for staff member.
parents
f683a4c5
cb2af134
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
74 additions
and
4 deletions
+74
-4
common/djangoapps/xmodule_modifiers.py
+2
-1
lms/djangoapps/courseware/access.py
+3
-2
lms/djangoapps/courseware/features/staff_debug_info.feature
+13
-0
lms/djangoapps/courseware/features/staff_debug_info.py
+51
-0
lms/djangoapps/courseware/module_render.py
+2
-1
lms/djangoapps/courseware/tests/test_access.py
+1
-0
lms/templates/staff_problem_info.html
+2
-0
No files found.
common/djangoapps/xmodule_modifiers.py
View file @
e6a9047f
...
...
@@ -157,7 +157,7 @@ def grade_histogram(module_id):
return
grades
def
add_staff_markup
(
user
,
block
,
view
,
frag
,
context
):
# pylint: disable=unused-argument
def
add_staff_markup
(
user
,
has_instructor_access
,
block
,
view
,
frag
,
context
):
# pylint: disable=unused-argument
"""
Updates the supplied module with a new get_html function that wraps
the output of the old get_html function with additional information
...
...
@@ -245,5 +245,6 @@ def add_staff_markup(user, block, view, frag, context): # pylint: disable=unuse
'render_histogram'
:
render_histogram
,
'block_content'
:
frag
.
content
,
'is_released'
:
is_released
,
'has_instructor_access'
:
has_instructor_access
,
}
return
wrap_fragment
(
frag
,
render_to_string
(
"staff_problem_info.html"
,
staff_context
))
lms/djangoapps/courseware/access.py
View file @
e6a9047f
...
...
@@ -274,8 +274,9 @@ def _has_access_descriptor(user, action, descriptor, course_key=None):
checkers
=
{
'load'
:
can_load
,
'staff'
:
lambda
:
_has_staff_access_to_descriptor
(
user
,
descriptor
,
course_key
)
}
'staff'
:
lambda
:
_has_staff_access_to_descriptor
(
user
,
descriptor
,
course_key
),
'instructor'
:
lambda
:
_has_instructor_access_to_descriptor
(
user
,
descriptor
,
course_key
)
}
return
_dispatch
(
checkers
,
action
,
user
,
descriptor
)
...
...
lms/djangoapps/courseware/features/staff_debug_info.feature
0 → 100644
View file @
e6a9047f
@shard_1
Feature
:
LMS.Debug staff info links
As a course staff in an edX course
In order to test my understanding of the material
I want to click on staff debug info links
Scenario
:
I
can reset student attempts
When
i am staff member for the course
"model_course"
And
I am viewing a
"multiple choice"
problem
And
I can view staff debug info
Then
I can reset student attempts
Then
I cannot see delete student state link
Then
I cannot see rescore student submission link
lms/djangoapps/courseware/features/staff_debug_info.py
0 → 100644
View file @
e6a9047f
"""
Steps for staff_debug_info.feature lettuce tests
"""
from
django.contrib.auth.models
import
User
from
lettuce
import
world
,
step
from
common
import
create_course
,
course_id
from
courseware.courses
import
get_course_by_id
from
instructor.access
import
allow_access
@step
(
u'i am staff member for the course "([^"]*)"$'
)
def
i_am_staff_member_for_the_course
(
step
,
course_number
):
# Create the course
create_course
(
step
,
course_number
)
course
=
get_course_by_id
(
course_id
(
course_number
))
# Create the user
world
.
create_user
(
'robot'
,
'test'
)
user
=
User
.
objects
.
get
(
username
=
'robot'
)
# Add user as a course staff.
allow_access
(
course
,
user
,
"staff"
)
world
.
log_in
(
username
=
'robot'
,
password
=
'test'
)
@step
(
u'I can view staff debug info'
)
def
view_staff_debug_info
(
step
):
css_selector
=
"a.instructor-info-action"
world
.
css_click
(
css_selector
)
world
.
wait_for_visible
(
"section.staff-modal"
)
@step
(
u'I can reset student attempts'
)
def
view_staff_debug_info
(
step
):
css_selector
=
"a.staff-debug-reset"
world
.
css_click
(
css_selector
)
world
.
wait_for_ajax_complete
()
@step
(
u'I cannot see delete student state link'
)
def
view_staff_debug_info
(
step
):
css_selector
=
"a.staff-debug-sdelete"
world
.
is_css_not_present
(
css_selector
)
@step
(
u'I cannot see rescore student submission link'
)
def
view_staff_debug_info
(
step
):
css_selector
=
"a.staff-debug-rescore"
world
.
is_css_not_present
(
css_selector
)
lms/djangoapps/courseware/module_render.py
View file @
e6a9047f
...
...
@@ -433,7 +433,8 @@ def get_module_system_for_user(user, field_data_cache,
if
settings
.
FEATURES
.
get
(
'DISPLAY_DEBUG_INFO_TO_STAFF'
):
if
has_access
(
user
,
'staff'
,
descriptor
,
course_id
):
block_wrappers
.
append
(
partial
(
add_staff_markup
,
user
))
has_instructor_access
=
has_access
(
user
,
'instructor'
,
descriptor
,
course_id
)
block_wrappers
.
append
(
partial
(
add_staff_markup
,
user
,
has_instructor_access
))
# These modules store data using the anonymous_student_id as a key.
# To prevent loss of data, we will continue to provide old modules with
...
...
lms/djangoapps/courseware/tests/test_access.py
View file @
e6a9047f
...
...
@@ -90,6 +90,7 @@ class AccessTestCase(TestCase):
# Always returns true because DISABLE_START_DATES is set in test.py
self
.
assertTrue
(
access
.
_has_access_descriptor
(
user
,
'load'
,
date
))
self
.
assertTrue
(
access
.
_has_access_descriptor
(
user
,
'instructor'
,
date
))
with
self
.
assertRaises
(
ValueError
):
access
.
_has_access_descriptor
(
user
,
'not_load_or_staff'
,
date
)
...
...
lms/templates/staff_problem_info.html
View file @
e6a9047f
...
...
@@ -64,10 +64,12 @@ ${block_content}
<div
data-location=
"${location.to_deprecated_string()}"
data-location-name=
"${location.name}"
>
[
<a
href=
"#"
id=
"staff-debug-reset"
class=
"staff-debug-reset"
>
${_('Reset Student Attempts')}
</a>
% if has_instructor_access:
|
<a
href=
"#"
id=
"staff-debug-sdelete"
class=
"staff-debug-sdelete"
>
${_('Delete Student State')}
</a>
|
<a
href=
"#"
id=
"staff-debug-rescore"
class=
"staff-debug-rescore"
>
${_('Rescore Student Submission')}
</a>
% endif
]
</div>
<div
id=
"result_${location.name}"
/>
...
...
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