Commit 8be8ac8f by Amir Qayyum Khan

Refactored ccx coach tab plugin

parent e1035c7b
...@@ -25,11 +25,12 @@ class CcxCourseTab(CourseTab): ...@@ -25,11 +25,12 @@ class CcxCourseTab(CourseTab):
""" """
Returns true if CCX has been enabled and the specified user is a coach 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 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 return False
if has_access(user, 'staff', course) or has_access(user, 'instructor', course): 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 return True
# check if user has coach access.
role = CourseCcxCoachRole(course.id) role = CourseCcxCoachRole(course.id)
return role.has_user(user) return role.has_user(user)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment