zammad/app/models/observer/session.rb
Thorsten Eckel e91553d164 - Refactored authentication_check_only.
- Replaced session[:request_type] with session[:persistent].
2015-06-24 10:49:50 +02:00

29 lines
695 B
Ruby

# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
require 'history'
class Observer::Session < ActiveRecord::Observer
observe 'active_record::_session_store::_session'
def before_create(record)
check(record)
end
def before_update(record)
check(record)
end
# move the persistent attribute from the sub structure
# to the first level so it gets stored in the database
# column to make the cleanup lookup more performant
def check(record)
return if !record.data
return if record[:persistent]
return if !record.data['persistent']
record[:persistent] = record.data['persistent']
record.data.delete('persistent')
end
end