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
cb2af134
Commit
cb2af134
authored
May 26, 2014
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed staff debug info endpoints for staff member.
LMS-2737
parent
f683a4c5
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
73 additions
and
3 deletions
+73
-3
common/djangoapps/xmodule_modifiers.py
+2
-1
lms/djangoapps/courseware/access.py
+2
-1
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 @
cb2af134
...
@@ -157,7 +157,7 @@ def grade_histogram(module_id):
...
@@ -157,7 +157,7 @@ def grade_histogram(module_id):
return
grades
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
Updates the supplied module with a new get_html function that wraps
the output of the old get_html function with additional information
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
...
@@ -245,5 +245,6 @@ def add_staff_markup(user, block, view, frag, context): # pylint: disable=unuse
'render_histogram'
:
render_histogram
,
'render_histogram'
:
render_histogram
,
'block_content'
:
frag
.
content
,
'block_content'
:
frag
.
content
,
'is_released'
:
is_released
,
'is_released'
:
is_released
,
'has_instructor_access'
:
has_instructor_access
,
}
}
return
wrap_fragment
(
frag
,
render_to_string
(
"staff_problem_info.html"
,
staff_context
))
return
wrap_fragment
(
frag
,
render_to_string
(
"staff_problem_info.html"
,
staff_context
))
lms/djangoapps/courseware/access.py
View file @
cb2af134
...
@@ -274,7 +274,8 @@ def _has_access_descriptor(user, action, descriptor, course_key=None):
...
@@ -274,7 +274,8 @@ def _has_access_descriptor(user, action, descriptor, course_key=None):
checkers
=
{
checkers
=
{
'load'
:
can_load
,
'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
)
return
_dispatch
(
checkers
,
action
,
user
,
descriptor
)
...
...
lms/djangoapps/courseware/features/staff_debug_info.feature
0 → 100644
View file @
cb2af134
@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 @
cb2af134
"""
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 @
cb2af134
...
@@ -433,7 +433,8 @@ def get_module_system_for_user(user, field_data_cache,
...
@@ -433,7 +433,8 @@ def get_module_system_for_user(user, field_data_cache,
if
settings
.
FEATURES
.
get
(
'DISPLAY_DEBUG_INFO_TO_STAFF'
):
if
settings
.
FEATURES
.
get
(
'DISPLAY_DEBUG_INFO_TO_STAFF'
):
if
has_access
(
user
,
'staff'
,
descriptor
,
course_id
):
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.
# 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
# To prevent loss of data, we will continue to provide old modules with
...
...
lms/djangoapps/courseware/tests/test_access.py
View file @
cb2af134
...
@@ -90,6 +90,7 @@ class AccessTestCase(TestCase):
...
@@ -90,6 +90,7 @@ class AccessTestCase(TestCase):
# Always returns true because DISABLE_START_DATES is set in test.py
# 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
,
'load'
,
date
))
self
.
assertTrue
(
access
.
_has_access_descriptor
(
user
,
'instructor'
,
date
))
with
self
.
assertRaises
(
ValueError
):
with
self
.
assertRaises
(
ValueError
):
access
.
_has_access_descriptor
(
user
,
'not_load_or_staff'
,
date
)
access
.
_has_access_descriptor
(
user
,
'not_load_or_staff'
,
date
)
...
...
lms/templates/staff_problem_info.html
View file @
cb2af134
...
@@ -64,10 +64,12 @@ ${block_content}
...
@@ -64,10 +64,12 @@ ${block_content}
<div
data-location=
"${location.to_deprecated_string()}"
data-location-name=
"${location.name}"
>
<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>
<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-sdelete"
class=
"staff-debug-sdelete"
>
${_('Delete Student State')}
</a>
|
|
<a
href=
"#"
id=
"staff-debug-rescore"
class=
"staff-debug-rescore"
>
${_('Rescore Student Submission')}
</a>
<a
href=
"#"
id=
"staff-debug-rescore"
class=
"staff-debug-rescore"
>
${_('Rescore Student Submission')}
</a>
% endif
]
]
</div>
</div>
<div
id=
"result_${location.name}"
/>
<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