16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'app/models/katello/concerns/content_view_filter_rule_common.rb', line 16
def create_audit_record(action)
audit = case action
when 'create'
Audit.new(
auditable_type: self.class,
auditable_id: id,
user_id: User.current.id,
user_type: 'User',
audited_changes: self.as_json,
associated_id: filter.content_view.id,
associated_type: filter.content_view.class,
action: action
)
when 'update'
Audit.new(
auditable_type: self.class,
auditable_id: id,
user_id: User.current.id,
user_type: 'User',
audited_changes: self.previous_changes,
associated_id: filter.content_view.id,
associated_type: filter.content_view.class,
action: action
)
when 'destroy'
Audit.new(
auditable_type: self.class,
auditable_id: id,
user_id: User.current.id,
user_type: 'User',
audited_changes: self.as_json,
associated_id: filter.content_view.id,
associated_type: filter.content_view.class,
action: action
)
end
audit&.save!
end
|