Skip to content

Commit

Permalink
Enroll allowed users on account creation
Browse files Browse the repository at this point in the history
  • Loading branch information
tusbar committed Mar 14, 2015
1 parent 870a39c commit 6a5b5d4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion common/djangoapps/third_party_auth/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def B(*args, **kwargs):
ItemAlreadyInCartException,
AlreadyEnrolledInCourseException
)
from student.models import CourseEnrollment, CourseEnrollmentException
from student.models import CourseEnrollment, CourseEnrollmentException, CourseEnrollmentAllowed
from course_modes.models import CourseMode
from opaque_keys.edx.keys import CourseKey

Expand Down Expand Up @@ -474,6 +474,11 @@ def create_user_from_oauth(strategy, details, user, is_new, *args, **kwargs):
log.error("UserProfile creation failed for user {id}.".format(id=user.id))
raise

ceas = CourseEnrollmentAllowed.objects.filter(email=user.email)
for cea in ceas:
if cea.auto_enroll:
CourseEnrollment.enroll(user, cea.course_id)

create_comments_service_user(user)


Expand Down

0 comments on commit 6a5b5d4

Please sign in to comment.