
def user_from_request(request):
    if hasattr(request.user, 'ldap_user'):
        # print(request.user.ldap_user.attrs.data)
        return {'name': request.user.username, 'source': 'ldap'}
    else:
        return {'name': request.user.username, 'source': 'system'}