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
e572eafa
Commit
e572eafa
authored
Mar 30, 2016
by
muzaffaryousaf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Staff should be able to masquerade when previewing content.
TNL-4291
parent
1dff9d45
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
lms/djangoapps/courseware/access.py
+1
-1
lms/djangoapps/courseware/tests/test_access.py
+10
-0
No files found.
lms/djangoapps/courseware/access.py
View file @
e572eafa
...
...
@@ -742,7 +742,7 @@ def _has_access_to_course(user, access_level, course_key):
debug
(
"Deny: no user or anon user"
)
return
ACCESS_DENIED
if
is_masquerading_as_student
(
user
,
course_key
):
if
not
in_preview_mode
()
and
is_masquerading_as_student
(
user
,
course_key
):
return
ACCESS_DENIED
if
GlobalStaff
()
.
has_user
(
user
):
...
...
lms/djangoapps/courseware/tests/test_access.py
View file @
e572eafa
...
...
@@ -278,6 +278,16 @@ class AccessTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase, MilestonesTes
self
.
assertFalse
(
bool
(
access
.
has_access
(
self
.
student
,
'staff'
,
self
.
course
,
course_key
=
self
.
course
.
id
)))
self
.
assertFalse
(
bool
(
access
.
has_access
(
self
.
student
,
'load'
,
self
.
course
,
course_key
=
self
.
course
.
id
)))
# User should be able to preview when masquerade.
with
patch
(
'courseware.access.is_masquerading_as_student'
)
as
mock_masquerade
:
mock_masquerade
.
return_value
=
True
self
.
assertTrue
(
bool
(
access
.
has_access
(
self
.
global_staff
,
'staff'
,
self
.
course
,
course_key
=
self
.
course
.
id
))
)
self
.
assertFalse
(
bool
(
access
.
has_access
(
self
.
student
,
'staff'
,
self
.
course
,
course_key
=
self
.
course
.
id
))
)
def
test_has_access_to_course
(
self
):
self
.
assertFalse
(
access
.
_has_access_to_course
(
None
,
'staff'
,
self
.
course
.
id
...
...
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