diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-07-03 14:54:50 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-07-06 12:36:08 +0300 |
commit | 411829fdb5f24f97ce17e05f5fd018d47075b216 (patch) | |
tree | aa39d65d78e0aa719df07ab268522a5bc3cb371f /app/models/audit_event.rb | |
parent | 8ba83cbab86349c5fa5ce5034df6ffc8225f137c (diff) | |
download | gitlab-ce-411829fdb5f24f97ce17e05f5fd018d47075b216.tar.gz |
Audit log for user authentication
Diffstat (limited to 'app/models/audit_event.rb')
-rw-r--r-- | app/models/audit_event.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/models/audit_event.rb b/app/models/audit_event.rb new file mode 100644 index 00000000000..967ffd46db0 --- /dev/null +++ b/app/models/audit_event.rb @@ -0,0 +1,19 @@ +class AuditEvent < ActiveRecord::Base + serialize :details, Hash + + belongs_to :user, foreign_key: :author_id + + validates :author_id, presence: true + validates :entity_id, presence: true + validates :entity_type, presence: true + + after_initialize :initialize_details + + def initialize_details + self.details = {} if details.nil? + end + + def author_name + self.user.name + end +end |