Exemplo n.º 1
0
  def process_request(self, request):
    user = request.user

    if not user or not user.is_authenticated:
      return

    profile = get_profile(user)
    expires_after = AUTH.IDLE_SESSION_TIMEOUT.get()
    now = datetime.now()
    logout = False

    if profile.last_activity and expires_after > 0 and self._total_seconds(now - profile.last_activity) > expires_after:
      logout = True

    # Save last activity for user except when polling
    if not (request.path.strip('/') == 'notebook/api/check_status') \
        and not (request.path.strip('/').startswith('jobbrowser/api/job')) \
        and not (request.path.strip('/') == 'jobbrowser/jobs' and request.POST.get('format') == 'json') \
        and not (request.path.strip('/') == 'desktop/debug/is_idle') \
        and not (request.path.strip('/').startswith('oozie/list_oozie_')):
      try:
        profile.last_activity = datetime.now()
        profile.hostname = get_localhost_name()
        profile.save()
      except DatabaseError:
        LOG.exception('Error saving profile information')

    if logout:
      dt_logout(request, next_page='/')
Exemplo n.º 2
0
  def process_request(self, request):
    user = request.user

    if not user or not user.is_authenticated():
      return

    profile = get_profile(user)
    expires_after = AUTH.IDLE_SESSION_TIMEOUT.get()
    now = datetime.now()
    logout = False

    if profile.last_activity and expires_after > 0 and self._total_seconds(now - profile.last_activity) > expires_after:
      logout = True

    # Save last activity for user except when polling
    if not (request.path.strip('/') == 'notebook/api/check_status') \
        and not (request.path.strip('/').startswith('jobbrowser/api/job')) \
        and not (request.path.strip('/') == 'jobbrowser/jobs' and request.POST.get('format') == 'json') \
        and not (request.path.strip('/') == 'desktop/debug/is_idle') \
        and not (request.path.strip('/').startswith('oozie/list_oozie_')):
      try:
        profile.last_activity = datetime.now()
        profile.save()
      except DatabaseError:
        LOG.exception('Error saving profile information')

    if logout:
      dt_logout(request, next_page='/')
Exemplo n.º 3
0
    def process_request(self, request):
        user = request.user

        if not user or not user.is_authenticated():
            return

        profile = get_profile(user)
        expires_after = AUTH.IDLE_SESSION_TIMEOUT.get()
        now = datetime.now()
        logout = False

        if (
            profile.last_activity
            and expires_after > 0
            and self._total_seconds(now - profile.last_activity) > expires_after
        ):
            logout = True

        # Save last activity for user except when polling
        if not (request.path.strip("/") == "jobbrowser/jobs" and request.POST.get("format") == "json") and not (
            request.path == "/desktop/debug/is_idle"
        ):
            try:
                profile.last_activity = datetime.now()
                profile.save()
            except DatabaseError:
                LOG.exception("Error saving profile information")

        if logout:
            dt_logout(request, next_page="/")
Exemplo n.º 4
0
    def process_request(self, request):
        user = request.user

        if not user or not user.is_authenticated():
            return

        profile = get_profile(user)
        expires_after = AUTH.IDLE_SESSION_TIMEOUT.get()
        now = datetime.now()
        logout = False

        if profile.last_activity and expires_after > 0 and self._total_seconds(
                now - profile.last_activity) > expires_after:
            messages.info(
                request,
                _('Your session has been timed out due to inactivity.'))
            logout = True

        # Save last activity for user except when polling jobbrowser
        if not (request.path.strip('/') == 'jobbrowser'
                and request.GET.get('format') == 'json'):
            try:
                profile.last_activity = datetime.now()
                profile.save()
            except DatabaseError:
                LOG.exception('Error saving profile information')

        if logout:
            dt_logout(request, next_page='/')
Exemplo n.º 5
0
  def process_request(self, request):
    user = request.user

    if not user or not user.is_authenticated():
      return

    profile = get_profile(user)
    expires_after = AUTH.IDLE_SESSION_TIMEOUT.get()
    now = datetime.now()
    logout = False

    if profile.last_activity and expires_after > 0 and self._total_seconds(now - profile.last_activity) > expires_after:
      messages.info(request, _('Your session has been timed out due to inactivity.'))
      logout = True

    # Save last activity for user except when polling jobbrowser
    if not (request.path.strip('/') == 'jobbrowser' and request.GET.get('format') == 'json'):
      try:
        profile.last_activity = datetime.now()
        profile.save()
      except DatabaseError:
        LOG.exception('Error saving profile information')

    if logout:
      dt_logout(request, next_page='/')