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
76d19dbe
Commit
76d19dbe
authored
Dec 11, 2017
by
Eric Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add DISABLE_LIBRARY_CREATION setting to library creator logic
EDUCATOR-1924
parent
25eb3187
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletions
+31
-1
cms/djangoapps/contentstore/views/library.py
+7
-1
cms/djangoapps/contentstore/views/tests/test_library.py
+24
-0
No files found.
cms/djangoapps/contentstore/views/library.py
View file @
76d19dbe
...
...
@@ -58,7 +58,13 @@ def get_library_creator_status(user):
elif
settings
.
FEATURES
.
get
(
'ENABLE_CREATOR_GROUP'
,
False
):
return
get_course_creator_status
(
user
)
==
'granted'
else
:
return
not
settings
.
FEATURES
.
get
(
'DISABLE_COURSE_CREATION'
,
False
)
# EDUCATOR-1924: DISABLE_LIBRARY_CREATION overrides DISABLE_COURSE_CREATION, if present.
disable_library_creation
=
settings
.
FEATURES
.
get
(
'DISABLE_LIBRARY_CREATION'
,
None
)
disable_course_creation
=
settings
.
FEATURES
.
get
(
'DISABLE_COURSE_CREATION'
,
False
)
if
disable_library_creation
is
not
None
:
return
not
disable_library_creation
else
:
return
not
disable_course_creation
@login_required
...
...
cms/djangoapps/contentstore/views/tests/test_library.py
View file @
76d19dbe
...
...
@@ -64,6 +64,30 @@ class UnitTestLibraries(CourseTestCase):
_
,
nostaff_user
=
self
.
create_non_staff_authed_user_client
()
self
.
assertEqual
(
get_library_creator_status
(
nostaff_user
),
True
)
@ddt.data
(
(
False
,
False
,
True
),
(
False
,
True
,
False
),
(
True
,
False
,
True
),
(
True
,
True
,
False
),
(
True
,
None
,
False
),
(
False
,
None
,
True
)
)
@ddt.unpack
def
test_library_creator_status_settings
(
self
,
disable_course
,
disable_library
,
expected_status
):
"""
Ensure that the setting DISABLE_LIBRARY_CREATION overrides DISABLE_COURSE_CREATION as expected.
"""
_
,
nostaff_user
=
self
.
create_non_staff_authed_user_client
()
with
mock
.
patch
(
"contentstore.views.library.LIBRARIES_ENABLED"
,
True
):
with
mock
.
patch
.
dict
(
"django.conf.settings.FEATURES"
,
{
"DISABLE_COURSE_CREATION"
:
disable_course
,
"DISABLE_LIBRARY_CREATION"
:
disable_library
}
):
self
.
assertEqual
(
get_library_creator_status
(
nostaff_user
),
expected_status
)
@mock.patch.dict
(
'django.conf.settings.FEATURES'
,
{
'DISABLE_COURSE_CREATION'
:
True
})
@mock.patch
(
"contentstore.views.library.LIBRARIES_ENABLED"
,
True
)
def
test_library_creator_status_with_no_course_creator_role_and_disabled_nonstaff_course_creation
(
self
):
...
...
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