Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
cb5e76ee
Commit
cb5e76ee
authored
7 years ago
by
Omar Al-Ithawi
Browse files
Options
Downloads
Patches
Plain Diff
Hide the create library for non-staff users when DISABLE_COURSE_CREATION
parent
19c2faee
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cms/djangoapps/contentstore/views/library.py
+1
-1
1 addition, 1 deletion
cms/djangoapps/contentstore/views/library.py
cms/djangoapps/contentstore/views/tests/test_library.py
+10
-0
10 additions, 0 deletions
cms/djangoapps/contentstore/views/tests/test_library.py
with
11 additions
and
1 deletion
cms/djangoapps/contentstore/views/library.py
+
1
−
1
View file @
cb5e76ee
...
...
@@ -58,7 +58,7 @@ def get_library_creator_status(user):
elif
settings
.
FEATURES
.
get
(
'
ENABLE_CREATOR_GROUP
'
,
False
):
return
get_course_creator_status
(
user
)
==
'
granted
'
else
:
return
True
return
not
settings
.
FEATURES
.
get
(
'
DISABLE_COURSE_CREATION
'
,
False
)
@login_required
...
...
This diff is collapsed.
Click to expand it.
cms/djangoapps/contentstore/views/tests/test_library.py
+
10
−
0
View file @
cb5e76ee
...
...
@@ -28,6 +28,7 @@ def make_url_for_lib(key):
@ddt.ddt
@mock.patch.dict
(
'
django.conf.settings.FEATURES
'
,
{
'
DISABLE_COURSE_CREATION
'
:
False
})
class
UnitTestLibraries
(
CourseTestCase
):
"""
Unit tests for library views
...
...
@@ -63,6 +64,15 @@ class UnitTestLibraries(CourseTestCase):
_
,
nostaff_user
=
self
.
create_non_staff_authed_user_client
()
self
.
assertEqual
(
get_library_creator_status
(
nostaff_user
),
True
)
@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
):
"""
Ensure that `DISABLE_COURSE_CREATION` feature works with libraries as well.
"""
_
,
nostaff_user
=
self
.
create_non_staff_authed_user_client
()
self
.
assertFalse
(
get_library_creator_status
(
nostaff_user
))
@patch
(
"
contentstore.views.library.LIBRARIES_ENABLED
"
,
False
)
def
test_with_libraries_disabled
(
self
):
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment