Lines Matching defs:User
1 from django.contrib.auth.models import User, Group, check_password
16 doing the real authentication. Also ensures logged-in user exists in
17 frontend.afe.models.User database.
21 user = User.objects.get(username=username)
22 except User.DoesNotExist:
24 user = User(username=username,
26 user.is_staff = True
27 user.save() # need to save before adding groups
28 user.groups.add(Group.objects.get(
32 return user
37 user, created = models.User.objects.get_or_create(login=username)
39 user.save()
43 return User.objects.get(pk=user_id)
44 except User.DoesNotExist:
59 user = request.META.get('REMOTE_USER')
60 if user is None:
61 # look for a user in headers. This is insecure but
63 user = request.META.get('HTTP_AUTHORIZATION')
64 if user is None:
65 # no user info - assume we're in development mode
66 user = constants.MOBLAB_USER if utils.is_moblab() else DEBUG_USER
67 thread_local.set_user(user)
72 Like GetApacheUserMiddleware, but also logs the user into Django's auth
73 system, and replaces the username in thread_local with the actual User model
85 thread_local.set_user(models.User.objects.get(login=username))