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
633eefb2
Commit
633eefb2
authored
Nov 08, 2016
by
jagonzalr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use CourseCreatorRole to determine if user can create a library
parent
2de535ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
cms/djangoapps/contentstore/views/course.py
+11
-5
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
633eefb2
...
@@ -467,7 +467,10 @@ def course_listing(request):
...
@@ -467,7 +467,10 @@ def course_listing(request):
List all courses available to the logged in user
List all courses available to the logged in user
"""
"""
courses
,
in_process_course_actions
=
get_courses_accessible_to_user
(
request
)
courses
,
in_process_course_actions
=
get_courses_accessible_to_user
(
request
)
libraries
=
_accessible_libraries_list
(
request
.
user
)
if
LIBRARIES_ENABLED
and
request
.
user
.
is_staff
else
[]
user
=
request
.
user
user_has_permission
=
\
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
[]
programs_config
=
ProgramsApiConfig
.
current
()
programs_config
=
ProgramsApiConfig
.
current
()
raw_programs
=
get_programs
(
request
.
user
)
if
programs_config
.
is_studio_tab_enabled
else
[]
raw_programs
=
get_programs
(
request
.
user
)
if
programs_config
.
is_studio_tab_enabled
else
[]
...
@@ -518,7 +521,7 @@ def course_listing(request):
...
@@ -518,7 +521,7 @@ def course_listing(request):
'in_process_course_actions'
:
in_process_course_actions
,
'in_process_course_actions'
:
in_process_course_actions
,
'libraries_enabled'
:
LIBRARIES_ENABLED
,
'libraries_enabled'
:
LIBRARIES_ENABLED
,
'libraries'
:
[
format_library_for_view
(
lib
)
for
lib
in
libraries
],
'libraries'
:
[
format_library_for_view
(
lib
)
for
lib
in
libraries
],
'show_new_library_button'
:
_get_library_creation_status
(
request
.
user
),
'show_new_library_button'
:
_get_library_creation_status
(
user
),
'user'
:
request
.
user
,
'user'
:
request
.
user
,
'request_course_creator_url'
:
reverse
(
'contentstore.views.request_course_creator'
),
'request_course_creator_url'
:
reverse
(
'contentstore.views.request_course_creator'
),
'course_creator_status'
:
_get_course_creator_status
(
request
.
user
),
'course_creator_status'
:
_get_course_creator_status
(
request
.
user
),
...
@@ -1657,9 +1660,12 @@ def _get_library_creation_status(user):
...
@@ -1657,9 +1660,12 @@ def _get_library_creation_status(user):
"""
"""
if
LIBRARIES_ENABLED
:
if
LIBRARIES_ENABLED
:
if
user
.
is_active
and
user
.
is_staff
:
if
user
.
is_active
:
if
not
settings
.
FEATURES
.
get
(
'DISABLE_LIBRARY_CREATION'
,
False
):
if
user
.
is_staff
or
CourseCreatorRole
()
.
has_user
(
user
):
return
True
if
not
settings
.
FEATURES
.
get
(
'DISABLE_LIBRARY_CREATION'
,
False
):
return
True
else
:
return
False
else
:
else
:
return
False
return
False
else
:
else
:
...
...
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