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
cc4349e9
Commit
cc4349e9
authored
Apr 01, 2016
by
Muzaffar yousaf
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11990 from edx/mzfr/prvw-masqrd-tnl4291
Staff should be able to masquerade when previewing content.
parents
c921f2ac
e572eafa
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 @
cc4349e9
...
...
@@ -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 @
cc4349e9
...
...
@@ -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