Browse Source

audit all

pull/1/head
Nicolae Claudius 11 years ago
parent
commit
a24c435b66
  1. 2
      app/models/a.rb
  2. 13
      app/models/user.rb

2
app/models/a.rb

@ -11,7 +11,7 @@
# Obtained from http://www.zytrax.com/books/dns/ch8/a.html
#
class A < Record
has_paper_trail ignore: [:content, :updated_at]
has_paper_trail
validates :name, :hostname => {:allow_underscore => true, :allow_wildcard_hostname => true}
validates :content, :presence => true, :ip => {:ip_type => :v4} # Only accept valid IPv4 addresses

13
app/models/user.rb

@ -2,11 +2,7 @@ class User < ActiveRecord::Base
include SentientModel
model_stamper
stampable
has_paper_trail ignore: [
:updated_at, :sign_in_count,
:last_sign_in_at, :current_sign_in_at,
:last_sign_in_ip, :current_sign_in_ip
]
has_paper_trail
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :timeoutable and :omniauthable
@ -56,6 +52,13 @@ class User < ActiveRecord::Base
"#{id} #{email} name:#{full_name} ip:#{current_sign_in_ip} last_ip:#{last_sign_in_ip}"
end
# @override
def update_tracked_fields!(*)
self.paper_trail_event = "sign_in"
PaperTrail.whodunnit = to_paper_trail
super
end
delegate :can?, :cannot?, :to => :ability
def ability(options = {:reload => false})

Loading…
Cancel
Save