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
00a42fe1
Commit
00a42fe1
authored
8 years ago
by
jagonzalr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show button new library in studio depending on flags and user staff status
parent
6c37e282
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
cms/djangoapps/contentstore/views/course.py
+22
-2
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
00a42fe1
...
@@ -467,7 +467,7 @@ def course_listing(request):
...
@@ -467,7 +467,7 @@ 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
else
[]
libraries
=
_accessible_libraries_list
(
request
.
user
)
if
LIBRARIES_ENABLED
and
request
.
user
.
is_staff
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 +518,7 @@ def course_listing(request):
...
@@ -518,7 +518,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'
:
LIBRARIES_ENABLED
and
request
.
user
.
is_active
,
'show_new_library_button'
:
_get_library_creation_status
(
request
.
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
),
...
@@ -1631,6 +1631,7 @@ def _get_course_creator_status(user):
...
@@ -1631,6 +1631,7 @@ def _get_course_creator_status(user):
If the user passed in has not previously visited the index page, it will be
If the user passed in has not previously visited the index page, it will be
added with status 'unrequested' if the course creator group is in use.
added with status 'unrequested' if the course creator group is in use.
"""
"""
if
user
.
is_staff
:
if
user
.
is_staff
:
course_creator_status
=
'granted'
course_creator_status
=
'granted'
elif
settings
.
FEATURES
.
get
(
'DISABLE_COURSE_CREATION'
,
False
):
elif
settings
.
FEATURES
.
get
(
'DISABLE_COURSE_CREATION'
,
False
):
...
@@ -1646,3 +1647,22 @@ def _get_course_creator_status(user):
...
@@ -1646,3 +1647,22 @@ def _get_course_creator_status(user):
course_creator_status
=
'granted'
course_creator_status
=
'granted'
return
course_creator_status
return
course_creator_status
def
_get_library_creation_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
and
user
.
is_staff
:
if
not
settings
.
FEATURES
.
get
(
'DISABLE_LIBRARY_CREATION'
,
False
):
return
True
else
:
return
False
else
:
return
False
else
:
return
False
This diff is collapsed.
Click to expand it.
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