Exemplo n.º 1
0
 def handle(self, *args, **options):
     try:
         u=User.objects.get(email=options['email'][0])
         print("Found %s %s (%s), activating admin rights."%(u.first_name, u.last_name, u.email))
         make_admin(u)
     except User.DoesNotExist:
         print("This user does not exist.")
Exemplo n.º 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)
Exemplo n.º 3
0
 def make_admin(self, request, queryset):
     for user in queryset:
         make_admin(user)