audited 4.0.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of audited might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +24 -3
- data/Appraisals +6 -0
- data/README.md +4 -4
- data/gemfiles/rails40.gemfile +1 -0
- data/gemfiles/rails42.gemfile +8 -0
- data/lib/audited.rb +1 -3
- data/lib/audited/active_record/version.rb +1 -1
- data/lib/audited/auditor.rb +10 -4
- data/lib/audited/mongo_mapper/version.rb +1 -1
- data/lib/audited/version.rb +2 -2
- data/spec/audited_spec_helpers.rb +5 -0
- data/spec/rails_app/config/database.yml +2 -2
- data/spec/rails_app/config/environments/test.rb +25 -16
- data/spec/support/active_record/schema.rb +1 -1
- metadata +70 -65
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e008bd8e45b0c84dac31af4c65d41e61b6f76c1f
|
4
|
+
data.tar.gz: 90ead5b1d9033c3426a20de46ea1aca59798b7ab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 33bd73a0be9da10924353681e4cccb3515dcd5ad9f47f3140ca18914532eef791f3b1c34caa11bb9dd47bd1be34f56751e5457b3946af70ccd20747f9c1215ce
|
7
|
+
data.tar.gz: bf7c70b57abf23809d08c899558f9a0effc393e2e1d526dcbc45c70f2302c6da96efa409506b6033e8ad87d0d13e97958d3a6515e1f23dd09cd12bb0a73ad4f0
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,9 +1,30 @@
|
|
1
1
|
language: ruby
|
2
2
|
services: mongodb
|
3
3
|
rvm:
|
4
|
-
-
|
5
|
-
- 2.
|
6
|
-
- 2.
|
4
|
+
- 2.0
|
5
|
+
- 2.1
|
6
|
+
- 2.2
|
7
|
+
- jruby-head
|
8
|
+
env:
|
9
|
+
- DB=SQLITE
|
10
|
+
- DB=POSTGRES
|
11
|
+
- DB=MYSQL
|
12
|
+
before_script:
|
13
|
+
- mysql -e 'create database audited_test;'
|
14
|
+
- psql -c 'create database audited_test;' -U postgres
|
7
15
|
gemfile:
|
8
16
|
- gemfiles/rails40.gemfile
|
9
17
|
- gemfiles/rails41.gemfile
|
18
|
+
- gemfiles/rails42.gemfile
|
19
|
+
matrix:
|
20
|
+
allow_failures:
|
21
|
+
- rvm: jruby-head
|
22
|
+
branches:
|
23
|
+
only:
|
24
|
+
- master
|
25
|
+
sudo: false
|
26
|
+
notifications:
|
27
|
+
webhooks:
|
28
|
+
urls:
|
29
|
+
- http://buildlight.collectiveidea.com/
|
30
|
+
on_start: true
|
data/Appraisals
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
appraise 'rails40' do
|
2
2
|
gem 'rails', '~> 4.0.0'
|
3
3
|
gem 'rails-observers'
|
4
|
+
gem 'test-unit'
|
4
5
|
end
|
5
6
|
|
6
7
|
appraise 'rails41' do
|
7
8
|
gem 'rails', '~> 4.1.0'
|
8
9
|
gem 'rails-observers'
|
9
10
|
end
|
11
|
+
|
12
|
+
appraise 'rails42' do
|
13
|
+
gem 'rails', '~> 4.2.0'
|
14
|
+
gem 'rails-observers'
|
15
|
+
end
|
data/README.md
CHANGED
@@ -3,15 +3,15 @@ Audited [![Build Status](https://secure.travis-ci.org/collectiveidea/audited.png
|
|
3
3
|
|
4
4
|
**Audited** (previously acts_as_audited) is an ORM extension that logs all changes to your models. Audited also allows you to record who made those changes, save comments and associate models related to the changes.
|
5
5
|
|
6
|
-
Audited currently (4.x) works with Rails 4. For Rails 3, use gem version 3.0 or see the [3.0-stable branch](https://github.com/collectiveidea/audited/tree/3.0-stable).
|
6
|
+
Audited currently (4.x) works with Rails 4.2. For Rails 3, use gem version 3.0 or see the [3.0-stable branch](https://github.com/collectiveidea/audited/tree/3.0-stable).
|
7
7
|
|
8
8
|
## Supported Rubies
|
9
9
|
|
10
10
|
Audited supports and is [tested against](http://travis-ci.org/collectiveidea/audited) the following Ruby versions:
|
11
11
|
|
12
|
-
* 1.9.3
|
13
12
|
* 2.0.0
|
14
|
-
* 2.1.
|
13
|
+
* 2.1.5
|
14
|
+
* 2.2.0
|
15
15
|
|
16
16
|
Audited may work just fine with a Ruby version not listed above, but we can't guarantee that it will. If you'd like to maintain a Ruby that isn't listed, please let us know with a [pull request](https://github.com/collectiveidea/audited/pulls).
|
17
17
|
|
@@ -153,7 +153,7 @@ class PostsController < ApplicationController
|
|
153
153
|
end
|
154
154
|
```
|
155
155
|
|
156
|
-
To use a method other than `current_user`, put the following in an
|
156
|
+
To use a method other than `current_user`, put the following in an initializer:
|
157
157
|
|
158
158
|
```ruby
|
159
159
|
Audited.current_user_method = :authenticated_user
|
data/gemfiles/rails40.gemfile
CHANGED
data/lib/audited.rb
CHANGED
data/lib/audited/auditor.rb
CHANGED
@@ -139,7 +139,7 @@ module Audited
|
|
139
139
|
def revision_with(attributes)
|
140
140
|
self.dup.tap do |revision|
|
141
141
|
revision.id = id
|
142
|
-
revision.send :instance_variable_set, '@attributes', self.attributes
|
142
|
+
revision.send :instance_variable_set, '@attributes', self.attributes if rails_below?('4.2.0')
|
143
143
|
revision.send :instance_variable_set, '@new_record', self.destroyed?
|
144
144
|
revision.send :instance_variable_set, '@persisted', !self.destroyed?
|
145
145
|
revision.send :instance_variable_set, '@readonly', false
|
@@ -162,6 +162,10 @@ module Audited
|
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
|
+
def rails_below?(rails_version)
|
166
|
+
Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new(rails_version)
|
167
|
+
end
|
168
|
+
|
165
169
|
private
|
166
170
|
|
167
171
|
def audited_changes
|
@@ -197,7 +201,7 @@ module Audited
|
|
197
201
|
|
198
202
|
def audit_destroy
|
199
203
|
write_audit(:action => 'destroy', :audited_changes => audited_attributes,
|
200
|
-
:comment => audit_comment)
|
204
|
+
:comment => audit_comment) unless self.new_record?
|
201
205
|
end
|
202
206
|
|
203
207
|
def write_audit(attrs)
|
@@ -234,10 +238,12 @@ module Audited
|
|
234
238
|
# @foo.save
|
235
239
|
# end
|
236
240
|
#
|
237
|
-
def without_auditing
|
241
|
+
def without_auditing
|
238
242
|
auditing_was_enabled = auditing_enabled
|
239
243
|
disable_auditing
|
240
|
-
|
244
|
+
yield
|
245
|
+
ensure
|
246
|
+
enable_auditing if auditing_was_enabled
|
241
247
|
end
|
242
248
|
|
243
249
|
def disable_auditing
|
data/lib/audited/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Audited
|
2
|
-
VERSION = "4.
|
3
|
-
end
|
2
|
+
VERSION = "4.2.0"
|
3
|
+
end
|
@@ -5,6 +5,11 @@ module AuditedSpecHelpers
|
|
5
5
|
klass.create({:name => 'Brandon', :username => 'brandon', :password => 'password'}.merge(attrs))
|
6
6
|
end
|
7
7
|
|
8
|
+
def build_user(use_mongo = false, attrs = {})
|
9
|
+
klass = use_mongo ? Models::MongoMapper::User : Models::ActiveRecord::User
|
10
|
+
klass.new({:name => 'darth', :username => 'darth', :password => 'noooooooo'}.merge(attrs))
|
11
|
+
end
|
12
|
+
|
8
13
|
def create_versions(n = 2, use_mongo = false)
|
9
14
|
klass = use_mongo ? Models::MongoMapper::User : Models::ActiveRecord::User
|
10
15
|
|
@@ -9,12 +9,12 @@ sqlite3: &SQLITE
|
|
9
9
|
postgresql: &POSTGRES
|
10
10
|
adapter: postgresql
|
11
11
|
username: postgres
|
12
|
-
password:
|
12
|
+
password:
|
13
13
|
database: audited_test
|
14
14
|
min_messages: ERROR
|
15
15
|
|
16
16
|
mysql: &MYSQL
|
17
|
-
adapter:
|
17
|
+
adapter: mysql2
|
18
18
|
host: localhost
|
19
19
|
username: root
|
20
20
|
password:
|
@@ -1,35 +1,44 @@
|
|
1
1
|
RailsApp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite.
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
6
|
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs.
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
|
-
#
|
11
|
-
#
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_assets = true
|
17
|
+
# Configure static file server for tests with Cache-Control for performance.
|
18
|
+
config.serve_static_files = true
|
19
|
+
config.static_cache_control = 'public, max-age=3600'
|
12
20
|
|
13
|
-
# Show full error reports and disable caching
|
21
|
+
# Show full error reports and disable caching.
|
14
22
|
config.consider_all_requests_local = true
|
15
|
-
config.action_controller.perform_caching = false
|
23
|
+
# config.action_controller.perform_caching = false
|
24
|
+
|
25
|
+
# Raise exceptions instead of rendering exception templates.
|
26
|
+
config.action_dispatch.show_exceptions = false
|
16
27
|
|
17
|
-
# Disable request forgery protection in test environment
|
18
|
-
config.action_controller.allow_forgery_protection
|
28
|
+
# Disable request forgery protection in test environment.
|
29
|
+
# config.action_controller.allow_forgery_protection = false
|
19
30
|
|
20
31
|
# Tell Action Mailer not to deliver emails to the real world.
|
21
32
|
# The :test delivery method accumulates sent emails in the
|
22
33
|
# ActionMailer::Base.deliveries array.
|
23
34
|
config.action_mailer.delivery_method = :test
|
24
35
|
|
25
|
-
#
|
26
|
-
|
27
|
-
# like if you have constraints or database-specific column types
|
28
|
-
# config.active_record.schema_format = :sql
|
29
|
-
|
30
|
-
config.action_dispatch.show_exceptions = false
|
36
|
+
# Randomize the order test cases are executed.
|
37
|
+
config.active_support.test_order = :random
|
31
38
|
|
39
|
+
# Print deprecation notices to the stderr.
|
32
40
|
config.active_support.deprecation = :stderr
|
33
41
|
|
34
|
-
|
42
|
+
# Raises error for missing translations
|
43
|
+
# config.action_view.raise_on_missing_translations = true
|
35
44
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'active_record'
|
2
2
|
require 'logger'
|
3
3
|
|
4
|
-
ActiveRecord::Base.establish_connection
|
4
|
+
ActiveRecord::Base.establish_connection
|
5
5
|
ActiveRecord::Base.logger = Logger.new(SPEC_ROOT.join('debug.log'))
|
6
6
|
ActiveRecord::Migration.verbose = false
|
7
7
|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: audited
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
5
|
-
prerelease:
|
4
|
+
version: 4.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brandon Keepers
|
@@ -14,145 +13,157 @@ authors:
|
|
14
13
|
autorequire:
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
|
-
date:
|
16
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
18
17
|
dependencies:
|
19
18
|
- !ruby/object:Gem::Dependency
|
20
19
|
name: rails-observers
|
21
20
|
requirement: !ruby/object:Gem::Requirement
|
22
|
-
none: false
|
23
21
|
requirements:
|
24
|
-
- - ~>
|
22
|
+
- - "~>"
|
25
23
|
- !ruby/object:Gem::Version
|
26
24
|
version: 0.1.2
|
27
25
|
type: :runtime
|
28
26
|
prerelease: false
|
29
27
|
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
none: false
|
31
28
|
requirements:
|
32
|
-
- - ~>
|
29
|
+
- - "~>"
|
33
30
|
- !ruby/object:Gem::Version
|
34
31
|
version: 0.1.2
|
35
32
|
- !ruby/object:Gem::Dependency
|
36
33
|
name: protected_attributes
|
37
34
|
requirement: !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
35
|
requirements:
|
40
|
-
- -
|
36
|
+
- - ">="
|
41
37
|
- !ruby/object:Gem::Version
|
42
38
|
version: '0'
|
43
39
|
type: :development
|
44
40
|
prerelease: false
|
45
41
|
version_requirements: !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
42
|
requirements:
|
48
|
-
- -
|
43
|
+
- - ">="
|
49
44
|
- !ruby/object:Gem::Version
|
50
45
|
version: '0'
|
51
46
|
- !ruby/object:Gem::Dependency
|
52
47
|
name: appraisal
|
53
48
|
requirement: !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
49
|
requirements:
|
56
|
-
- - ~>
|
50
|
+
- - "~>"
|
57
51
|
- !ruby/object:Gem::Version
|
58
52
|
version: 1.0.0
|
59
53
|
type: :development
|
60
54
|
prerelease: false
|
61
55
|
version_requirements: !ruby/object:Gem::Requirement
|
62
|
-
none: false
|
63
56
|
requirements:
|
64
|
-
- - ~>
|
57
|
+
- - "~>"
|
65
58
|
- !ruby/object:Gem::Version
|
66
59
|
version: 1.0.0
|
67
60
|
- !ruby/object:Gem::Dependency
|
68
|
-
name:
|
61
|
+
name: mongo_mapper
|
69
62
|
requirement: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
63
|
requirements:
|
72
|
-
- - ~>
|
64
|
+
- - "~>"
|
73
65
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
66
|
+
version: 0.13.0.beta2
|
75
67
|
type: :development
|
76
68
|
prerelease: false
|
77
69
|
version_requirements: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
70
|
requirements:
|
80
|
-
- - ~>
|
71
|
+
- - "~>"
|
81
72
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
73
|
+
version: 0.13.0.beta2
|
83
74
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
75
|
+
name: rails
|
85
76
|
requirement: !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
77
|
requirements:
|
88
|
-
- - ~>
|
78
|
+
- - "~>"
|
89
79
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
80
|
+
version: 4.2.0
|
91
81
|
type: :development
|
92
82
|
prerelease: false
|
93
83
|
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
84
|
requirements:
|
96
|
-
- - ~>
|
85
|
+
- - "~>"
|
97
86
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
87
|
+
version: 4.2.0
|
99
88
|
- !ruby/object:Gem::Dependency
|
100
|
-
name: rails
|
89
|
+
name: rspec-rails
|
101
90
|
requirement: !ruby/object:Gem::Requirement
|
102
|
-
none: false
|
103
91
|
requirements:
|
104
|
-
- - ~>
|
92
|
+
- - "~>"
|
105
93
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
94
|
+
version: '3.0'
|
107
95
|
type: :development
|
108
96
|
prerelease: false
|
109
97
|
version_requirements: !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
98
|
requirements:
|
112
|
-
- - ~>
|
99
|
+
- - "~>"
|
113
100
|
- !ruby/object:Gem::Version
|
114
|
-
version:
|
101
|
+
version: '3.0'
|
115
102
|
- !ruby/object:Gem::Dependency
|
116
|
-
name:
|
103
|
+
name: sqlite3
|
117
104
|
requirement: !ruby/object:Gem::Requirement
|
118
|
-
none: false
|
119
105
|
requirements:
|
120
|
-
- - ~>
|
106
|
+
- - "~>"
|
121
107
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
108
|
+
version: '1.2'
|
123
109
|
type: :development
|
124
110
|
prerelease: false
|
125
111
|
version_requirements: !ruby/object:Gem::Requirement
|
126
|
-
none: false
|
127
112
|
requirements:
|
128
|
-
- - ~>
|
113
|
+
- - "~>"
|
129
114
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
115
|
+
version: '1.2'
|
131
116
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
117
|
+
name: mysql2
|
118
|
+
requirement: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - "~>"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0.3'
|
123
|
+
type: :development
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0.3'
|
130
|
+
- !ruby/object:Gem::Dependency
|
131
|
+
name: pg
|
132
|
+
requirement: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - "~>"
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0.17'
|
137
|
+
type: :development
|
138
|
+
prerelease: false
|
139
|
+
version_requirements: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0.17'
|
144
|
+
- !ruby/object:Gem::Dependency
|
145
|
+
name: bson_ext
|
133
146
|
requirement: !ruby/object:Gem::Requirement
|
134
|
-
none: false
|
135
147
|
requirements:
|
136
|
-
- - ~>
|
148
|
+
- - "~>"
|
137
149
|
- !ruby/object:Gem::Version
|
138
|
-
version: '1.
|
150
|
+
version: '1.6'
|
139
151
|
type: :development
|
140
152
|
prerelease: false
|
141
153
|
version_requirements: !ruby/object:Gem::Requirement
|
142
|
-
none: false
|
143
154
|
requirements:
|
144
|
-
- - ~>
|
155
|
+
- - "~>"
|
145
156
|
- !ruby/object:Gem::Version
|
146
|
-
version: '1.
|
157
|
+
version: '1.6'
|
147
158
|
description: Log all changes to your models
|
148
159
|
email: info@collectiveidea.com
|
149
160
|
executables: []
|
150
161
|
extensions: []
|
151
162
|
extra_rdoc_files: []
|
152
163
|
files:
|
153
|
-
- .gitignore
|
154
|
-
- .travis.yml
|
155
|
-
- .yardopts
|
164
|
+
- ".gitignore"
|
165
|
+
- ".travis.yml"
|
166
|
+
- ".yardopts"
|
156
167
|
- Appraisals
|
157
168
|
- CHANGELOG
|
158
169
|
- Gemfile
|
@@ -161,6 +172,7 @@ files:
|
|
161
172
|
- Rakefile
|
162
173
|
- gemfiles/rails40.gemfile
|
163
174
|
- gemfiles/rails41.gemfile
|
175
|
+
- gemfiles/rails42.gemfile
|
164
176
|
- lib/audited.rb
|
165
177
|
- lib/audited/active_record/version.rb
|
166
178
|
- lib/audited/audit.rb
|
@@ -197,33 +209,26 @@ files:
|
|
197
209
|
homepage: https://github.com/collectiveidea/audited
|
198
210
|
licenses:
|
199
211
|
- MIT
|
212
|
+
metadata: {}
|
200
213
|
post_install_message:
|
201
214
|
rdoc_options: []
|
202
215
|
require_paths:
|
203
216
|
- lib
|
204
217
|
required_ruby_version: !ruby/object:Gem::Requirement
|
205
|
-
none: false
|
206
218
|
requirements:
|
207
|
-
- -
|
219
|
+
- - ">="
|
208
220
|
- !ruby/object:Gem::Version
|
209
221
|
version: '0'
|
210
|
-
segments:
|
211
|
-
- 0
|
212
|
-
hash: -725083918367119279
|
213
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
|
-
none: false
|
215
223
|
requirements:
|
216
|
-
- -
|
224
|
+
- - ">="
|
217
225
|
- !ruby/object:Gem::Version
|
218
226
|
version: '0'
|
219
|
-
segments:
|
220
|
-
- 0
|
221
|
-
hash: -725083918367119279
|
222
227
|
requirements: []
|
223
228
|
rubyforge_project:
|
224
|
-
rubygems_version:
|
229
|
+
rubygems_version: 2.4.6
|
225
230
|
signing_key:
|
226
|
-
specification_version:
|
231
|
+
specification_version: 4
|
227
232
|
summary: Log all changes to your models
|
228
233
|
test_files:
|
229
234
|
- spec/audited_spec_helpers.rb
|