def has_team_api_access(user, course_key, access_username=None):
 if user.is_staff:
  return True
 if CourseStaffRole(course_key).has_user(user):
  return True
 if has_discussion_privileges(user, course_key):
  return True
 if ((not access_username) or (access_username == user.username)):
  return CourseEnrollment.is_enrolled(user, course_key)
 return False

def has_team_api_access ( user , course_key , access_username = None ) : if user . is_staff : return True if CourseStaffRole ( course_key ) . has_user ( user ) : return True if has_discussion_privileges ( user , course_key ) : return True if ( ( not access_username ) or ( access_username == user . username ) ) : return CourseEnrollment . is_enrolled ( user , course_key ) return False
returns true if the user has access to the team api for the course given by course_key .