Middleware created for course_permission and login_required