Beispiel #1
0
def keepalive(request):
    if request.user.is_authenticated():
        my_timeoff = calculate_my_time_off(request.user)
        return JsonResponse({'my_timeoff': my_timeoff ,
                             'my_safe_timeoff': my_timeoff -10 ,
                             'Im_authenticate': True, })
    else:
        return JsonResponse({'timeout': 0, 'safetimeout': 0, 'authenticate': False, })
Beispiel #2
0
    def process_request(self, request):
        if request.user.is_authenticated:
            if 'lastRequest' in request.session:            
                elapsedTime = datetime.datetime.now() - request.session['lastRequest']
                maxim_timeout = calculate_my_time_off(request.user)
                if elapsedTime.seconds > maxim_timeout:
                    del request.session['lastRequest'] 
                    logout(request)

            request.session['lastRequest'] = datetime.datetime.now()
        else:
            if 'lastRequest' in request.session:
                del request.session['lastRequest'] 

        return None
Beispiel #3
0
    def process_request(self, request):
        if request.user.is_authenticated():
            if 'lastRequest' in request.session:            
                elapsedTime = datetime.datetime.now() - request.session['lastRequest']
                maxim_timeout = calculate_my_time_off(request.user)
                if elapsedTime.seconds > maxim_timeout:
                    del request.session['lastRequest'] 
                    logout(request)

            request.session['lastRequest'] = datetime.datetime.now()
        else:
            if 'lastRequest' in request.session:
                del request.session['lastRequest'] 

        return None
def dades_basiques(request):

    (user, l4) = tools.getImpersonateUser(request)
    sessioImpersonada = tools.sessioImpersonada(request)

    my_timeoff = calculate_my_time_off(request.user)
    return {
            'data': date.today(),
            'user': user,
            'l4': l4,
            'sessioImpersonada': sessioImpersonada,
            'menu': calcula_menu( user, request.path_info ),
            'my_timeoff': my_timeoff,
            'my_safe_timeoff': my_timeoff - 10 if bool(my_timeoff) else my_timeoff,
            'es_direccio_o_impersonat': sessioImpersonada or user.groups.filter( name=u"direcció" ),
             }
Beispiel #5
0
def dades_basiques(request):

    (user, l4) = tools.getImpersonateUser(request)
    sessioImpersonada = tools.sessioImpersonada(request)

    my_timeoff = calculate_my_time_off(request.user)
    return {
        'data':
        date.today(),
        'user':
        user,
        'l4':
        l4,
        'sessioImpersonada':
        sessioImpersonada,
        'menu':
        calcula_menu(user, request.path_info, sessioImpersonada),
        'my_timeoff':
        my_timeoff,
        'my_safe_timeoff':
        my_timeoff - 10 if bool(my_timeoff) else my_timeoff,
        'es_direccio_o_impersonat':
        sessioImpersonada or user.groups.filter(name=u"direcció"),
    }