Add associations between Host, Session & SessionEvent model objects.
git-svn-id: file:///home/svn/framework3/trunk@12325 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
50155919ea
commit
175cae5047
|
@ -11,6 +11,7 @@ class Host < ActiveRecord::Base
|
|||
has_many :vulns, :dependent => :destroy
|
||||
has_many :notes, :dependent => :destroy
|
||||
has_many :loots, :dependent => :destroy, :order => "loots.created_at desc"
|
||||
has_many :sessions, :dependent => :destroy, :order => "sessions.opened_at"
|
||||
|
||||
has_many :service_notes, :through => :services
|
||||
has_many :web_sites, :through => :services
|
||||
|
|
|
@ -2,7 +2,15 @@ module Msf
|
|||
class DBManager
|
||||
|
||||
class Session < ActiveRecord::Base
|
||||
has_one :host
|
||||
belongs_to :host
|
||||
|
||||
has_one :workspace, :through => :host
|
||||
|
||||
has_many :events, :class_name => "SessionEvent", :order => "created_at"
|
||||
|
||||
named_scope :alive, :conditions => "closed_at IS NULL"
|
||||
named_scope :dead, :conditions => "closed_at IS NOT NULL"
|
||||
|
||||
serialize :datastore
|
||||
serialize :routes
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
module Msf
|
||||
class DBManager
|
||||
|
||||
# TODO: needs a belongs_to :session when that model gets committed.
|
||||
|
||||
class SessionEvent < ActiveRecord::Base
|
||||
include DBSave
|
||||
|
||||
belongs_to :session
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue