'This method is assuming that a `master_course_id` parameter
is available in the request as a GET parameter, a POST parameter
or it is in the JSON payload included in the request.
The reason is because this permission class is going
to check if the user making the request is an instructor
for the specified course.'

def has_permission(self, request, view):

    master_course_id = (request.GET.get('master_course_id') or request.POST.get('master_course_id') or request.data.get('master_course_id'))
    if (master_course_id is not None):
        try:
            course_key = CourseKey.from_string(master_course_id)
        except InvalidKeyError:
            raise Http404()
        return (hasattr(request, 'user') and (CourseInstructorRole(course_key).has_user(request.user) or CourseStaffRole(course_key).has_user(request.user)))
    return False
