class RubyCAS::Server::Core::Tickets::TicketGrantingTicket
Public Class Methods
cleanup(max_lifetime)
click to toggle source
# File lib/rubycas/server/activerecord/model/ticket_granting_ticket.rb, line 29 def self.cleanup(max_lifetime) transaction do conditions = ["created_at < ?", Time.now - max_lifetime] expired_tickets_count = count(:conditions => conditions) $LOG.debug("Destroying #{expired_tickets_count} expired #{self.name.demodulize}"+ "#{'s' if expired_tickets_count > 1}.") if expired_tickets_count > 0 destroy_all(conditions) end end
Public Instance Methods
consume!()
click to toggle source
# File lib/rubycas/server/activerecord/model/ticket_granting_ticket.rb, line 24 def consume! consumed = true self.save end
consumed?()
click to toggle source
# File lib/rubycas/server/activerecord/model/ticket_granting_ticket.rb, line 20 def consumed? consumed end
expired?(max_lifetime)
click to toggle source
# File lib/rubycas/server/activerecord/model/ticket_granting_ticket.rb, line 16 def expired?(max_lifetime) lifetime = Time.now.to_i - created_at.to_time.to_i lifetime > max_lifetime end
Protected Instance Methods
default_remember_me()
click to toggle source
# File lib/rubycas/server/activerecord/model/ticket_granting_ticket.rb, line 42 def default_remember_me remember_me = false if remember_me.nil? #If your callback function returns false, then rails won't save the object #as it cancels all callbacks !! return true end