Пример #1
0
 def handle(self, *args, **options):
     try:
         u=User.objects.get(email=options['email'][0])
         print("Found %s %s (%s), activating course owner rights."%(u.first_name, u.last_name, u.email))
         make_owner(u)
     except User.DoesNotExist:
         print("This user does not exist.")
Пример #2
0
def assign_role(backend, user, response, *args, **kwargs):
    '''
    Part of the Python Social Auth Pipeline.
    Checks if the created demo user should be pushed into some group.
    '''
    if backend.name is 'passthrough' and settings.DEMO is True and 'role' in kwargs[
            'request'].session[passthrough.SESSION_VAR]:
        role = kwargs['request'].session[passthrough.SESSION_VAR]['role']
        if role == 'tutor':
            make_tutor(user)
        if role == 'admin':
            make_admin(user)
        if role == 'owner':
            make_owner(user)
Пример #3
0
 def make_owner(self, request, queryset):
     for user in queryset:
         make_owner(user)