Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
387521a4
Commit
387521a4
authored
Dec 18, 2014
by
muzaffaryousaf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating the require_course_staff decorator to work with json handler.
TNL-900
parent
1b6ea97c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
openassessment/xblock/staff_info_mixin.py
+6
-1
openassessment/xblock/test/test_staff_info.py
+3
-2
No files found.
openassessment/xblock/staff_info_mixin.py
View file @
387521a4
...
@@ -4,9 +4,11 @@ determine the flow of the problem.
...
@@ -4,9 +4,11 @@ determine the flow of the problem.
"""
"""
import
copy
import
copy
from
functools
import
wraps
from
functools
import
wraps
import
json
import
logging
import
logging
from
xblock.core
import
XBlock
from
xblock.core
import
XBlock
import
sys
from
openassessment.assessment.errors
import
(
from
openassessment.assessment.errors
import
(
PeerAssessmentInternalError
,
PeerAssessmentWorkflowError
,
PeerAssessmentInternalError
,
PeerAssessmentWorkflowError
,
)
)
...
@@ -74,7 +76,10 @@ def require_course_staff(error_key, with_json_handler=False):
...
@@ -74,7 +76,10 @@ def require_course_staff(error_key, with_json_handler=False):
"STUDENT_INFO"
:
xblock
.
_
(
u"You do not have permission to access student information."
),
"STUDENT_INFO"
:
xblock
.
_
(
u"You do not have permission to access student information."
),
}
}
if
(
not
xblock
.
is_course_staff
and
with_json_handler
)
or
xblock
.
in_studio_preview
:
if
not
xblock
.
is_course_staff
and
with_json_handler
:
return
{
"success"
:
False
,
"msg"
:
permission_errors
[
error_key
]}
elif
not
xblock
.
is_course_staff
or
xblock
.
in_studio_preview
:
return
xblock
.
render_error
(
permission_errors
[
error_key
])
return
xblock
.
render_error
(
permission_errors
[
error_key
])
else
:
else
:
return
func
(
xblock
,
*
args
,
**
kwargs
)
return
func
(
xblock
,
*
args
,
**
kwargs
)
...
...
openassessment/xblock/test/test_staff_info.py
View file @
387521a4
...
@@ -520,8 +520,9 @@ class TestCourseStaff(XBlockHandlerTestCase):
...
@@ -520,8 +520,9 @@ class TestCourseStaff(XBlockHandlerTestCase):
def
test_cancel_submission_without_reason
(
self
,
xblock
):
def
test_cancel_submission_without_reason
(
self
,
xblock
):
# If we're not course staff, we shouldn't be able to see the
# If we're not course staff, we shouldn't be able to see the
# cancel submission option
# cancel submission option
xblock
.
xmodule_runtime
=
Mock
(
user_is_staff
=
False
)
xblock
.
xmodule_runtime
=
self
.
_create_mock_runtime
(
self
.
assertFalse
(
xblock
.
is_course_staff
)
xblock
.
scope_ids
.
usage_id
,
False
,
False
,
"Bob"
)
resp
=
self
.
request
(
xblock
,
'cancel_submission'
,
json
.
dumps
({}))
resp
=
self
.
request
(
xblock
,
'cancel_submission'
,
json
.
dumps
({}))
self
.
assertIn
(
"you do not have permission"
,
resp
.
decode
(
'utf-8'
)
.
lower
())
self
.
assertIn
(
"you do not have permission"
,
resp
.
decode
(
'utf-8'
)
.
lower
())
...
...
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