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
9cf08261
Commit
9cf08261
authored
Nov 18, 2016
by
jagonzalr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check for course creator role for library creation
parent
fe5becb4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
cms/djangoapps/contentstore/views/course.py
+19
-20
cms/envs/common.py
+1
-0
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
9cf08261
...
...
@@ -468,9 +468,9 @@ def course_listing(request):
"""
courses
,
in_process_course_actions
=
get_courses_accessible_to_user
(
request
)
user
=
request
.
user
user_
has_permission
=
\
user_
can_see_libraries
=
\
user
.
is_active
and
(
user
.
is_staff
or
CourseCreatorRole
()
.
has_user
(
user
))
libraries
=
_accessible_libraries_list
(
request
.
user
)
if
LIBRARIES_ENABLED
and
user_
has_permission
else
[]
libraries
=
_accessible_libraries_list
(
request
.
user
)
if
LIBRARIES_ENABLED
and
user_
can_see_libraries
else
[]
programs_config
=
ProgramsApiConfig
.
current
()
raw_programs
=
get_programs
(
request
.
user
)
if
programs_config
.
is_studio_tab_enabled
else
[]
...
...
@@ -519,16 +519,16 @@ def course_listing(request):
return
render_to_response
(
'index.html'
,
{
'courses'
:
courses
,
'in_process_course_actions'
:
in_process_course_actions
,
'libraries_enabled'
:
LIBRARIES_ENABLED
,
'libraries'
:
[
format_library_for_view
(
lib
)
for
lib
in
libraries
],
'show_new_library_button'
:
_get_library_creation_status
(
user
),
'user'
:
request
.
user
,
'user'
:
user
,
'request_course_creator_url'
:
reverse
(
'contentstore.views.request_course_creator'
),
'course_creator_status'
:
_get_course_creator_status
(
user
),
'rerun_creator_status'
:
GlobalStaff
()
.
has_user
(
user
),
'allow_unicode_course_id'
:
settings
.
FEATURES
.
get
(
'ALLOW_UNICODE_COURSE_ID'
,
False
),
'allow_course_reruns'
:
settings
.
FEATURES
.
get
(
'ALLOW_COURSE_RERUNS'
,
True
),
'is_programs_enabled'
:
programs_config
.
is_studio_tab_enabled
and
request
.
user
.
is_staff
,
'libraries_enabled'
:
LIBRARIES_ENABLED
,
'libraries'
:
[
format_library_for_view
(
lib
)
for
lib
in
libraries
],
'library_creator_status'
:
_get_library_creator_status
(
user
),
'is_programs_enabled'
:
programs_config
.
is_studio_tab_enabled
and
user
.
is_staff
,
'programs'
:
programs
,
'program_authoring_url'
:
reverse
(
'programs'
)
})
...
...
@@ -1652,23 +1652,22 @@ def _get_course_creator_status(user):
return
course_creator_status
def
_get_library_creat
ion
_status
(
user
):
def
_get_library_creat
or
_status
(
user
):
"""
Helper method for returning the library creation status for a particular user,
taking into account the values of DISABLE_LIBRARY_CREATION and LIBRARIES_ENABLED.
"""
if
LIBRARIES_ENABLED
:
if
user
.
is_active
:
if
user
.
is_staff
or
CourseCreatorRole
()
.
has_user
(
user
):
if
not
settings
.
FEATURES
.
get
(
'DISABLE_LIBRARY_CREATION'
,
False
):
return
True
else
:
return
False
else
:
return
False
else
:
return
False
if
not
LIBRARIES_ENABLED
:
library_creator_status
=
'disallowed_for_this_site'
elif
user
.
is_staff
:
library_creator_status
=
'granted'
elif
CourseCreatorRole
()
.
has_user
(
user
):
library_creator_status
=
'granted'
elif
settings
.
FEATURES
.
get
(
'DISABLE_LIBRARY_CREATION'
,
False
):
library_creator_status
=
'disallowed_for_this_site'
else
:
return
False
library_creator_status
=
'disallowed_for_this_site'
return
library_creator_status
cms/envs/common.py
View file @
9cf08261
...
...
@@ -167,6 +167,7 @@ FEATURES = {
# Enable support for content libraries. Note that content libraries are
# only supported in courses using split mongo.
'ENABLE_CONTENT_LIBRARIES'
:
True
,
'DISABLE_LIBRARY_CREATION'
:
False
,
# Milestones application flag
...
...
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