Refactored ccx coach tab plugin
This commit is contained in:
@@ -25,11 +25,12 @@ class CcxCourseTab(CourseTab):
|
||||
"""
|
||||
Returns true if CCX has been enabled and the specified user is a coach
|
||||
"""
|
||||
if not user:
|
||||
return True
|
||||
if not settings.FEATURES.get('CUSTOM_COURSES_EDX', False) or not course.enable_ccx:
|
||||
# If ccx is not enable do not show ccx coach tab.
|
||||
return False
|
||||
if has_access(user, 'staff', course) or has_access(user, 'instructor', course):
|
||||
# if user is staff or instructor then he can always see ccx coach tab.
|
||||
return True
|
||||
# check if user has coach access.
|
||||
role = CourseCcxCoachRole(course.id)
|
||||
return role.has_user(user)
|
||||
|
||||
Reference in New Issue
Block a user