ixtlan-audit 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ixtlan/audit/user_logger.rb +14 -6
- metadata +3 -5
@@ -27,19 +27,27 @@ module Ixtlan
|
|
27
27
|
log_user(login_from(controller)) do
|
28
28
|
as_xml = controller.response.content_type == 'application/xml' ? " - xml" : ""
|
29
29
|
if controller.params[:controller]
|
30
|
-
|
30
|
+
clname = controller.params[:controller]
|
31
|
+
cname = clname.sub(/^.*\//, '')
|
32
|
+
audits = controller.instance_variable_get("@#{cname}")
|
31
33
|
if(audits)
|
32
|
-
"#{
|
34
|
+
"#{clname}##{controller.params[:action]} #{cname.classify}[#{audits.size}]#{as_xml}#{message}"
|
33
35
|
else
|
34
|
-
audit = controller.instance_variable_get("@#{
|
36
|
+
audit = controller.instance_variable_get("@#{cname.singularize}")
|
35
37
|
if(audit)
|
36
38
|
errors = if(audit.respond_to?(:errors) && !audit.errors.empty?)
|
37
39
|
" - errors: " + audit.errors.full_messages.join(", ")
|
38
40
|
end
|
39
|
-
audit_log = audit.respond_to?(:to_log)
|
40
|
-
|
41
|
+
audit_log = if audit.respond_to?(:to_log)
|
42
|
+
audit.to_log
|
43
|
+
elsif audit.is_a? String
|
44
|
+
audit
|
45
|
+
else
|
46
|
+
"#{audit.class.name}(#{audit.id})"
|
47
|
+
end
|
48
|
+
"#{clname}##{controller.params[:action]} #{audit_log}#{as_xml}#{message}#{errors}"
|
41
49
|
else
|
42
|
-
"#{
|
50
|
+
"#{clname}##{controller.params[:action]}#{as_xml}#{message}"
|
43
51
|
end
|
44
52
|
end
|
45
53
|
else
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ixtlan-audit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- mkristian
|
@@ -10,8 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
14
|
-
default_executable:
|
13
|
+
date: 2012-07-04 00:00:00 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: slf4r
|
@@ -102,7 +101,6 @@ files:
|
|
102
101
|
- lib/ixtlan/audit/user_logger.rb~
|
103
102
|
- spec/audit_manager_spec.rb
|
104
103
|
- spec/audit_manager_spec.rb~
|
105
|
-
has_rdoc: true
|
106
104
|
homepage: http://github.com/mkristian/ixtlan-audit
|
107
105
|
licenses:
|
108
106
|
- MIT-LICENSE
|
@@ -127,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
125
|
requirements: []
|
128
126
|
|
129
127
|
rubyforge_project:
|
130
|
-
rubygems_version: 1.
|
128
|
+
rubygems_version: 1.8.24
|
131
129
|
signing_key:
|
132
130
|
specification_version: 3
|
133
131
|
summary: audit the controller actions for the current user
|