audited 4.7.0 → 4.10.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.

@@ -7,6 +7,7 @@ module Models
7
7
  audited except: :password
8
8
  attribute :non_column_attr if Rails.version >= '5.1'
9
9
  attr_protected :logins if respond_to?(:attr_protected)
10
+ enum status: { active: 0, reliable: 1, banned: 2 }
10
11
 
11
12
  def name=(val)
12
13
  write_attribute(:name, CGI.escapeHTML(val))
@@ -24,6 +25,21 @@ module Models
24
25
  audited only: :password
25
26
  end
26
27
 
28
+ class UserRedactedPassword < ::ActiveRecord::Base
29
+ self.table_name = :users
30
+ audited redacted: :password
31
+ end
32
+
33
+ class UserMultipleRedactedAttributes < ::ActiveRecord::Base
34
+ self.table_name = :users
35
+ audited redacted: [:password, :ssn]
36
+ end
37
+
38
+ class UserRedactedPasswordCustomRedaction < ::ActiveRecord::Base
39
+ self.table_name = :users
40
+ audited redacted: :password, redaction_value: ["My", "Custom", "Value", 7]
41
+ end
42
+
27
43
  class CommentRequiredUser < ::ActiveRecord::Base
28
44
  self.table_name = :users
29
45
  audited comment_required: true
@@ -44,6 +60,11 @@ module Models
44
60
  audited comment_required: true, on: :destroy
45
61
  end
46
62
 
63
+ class NoUpdateWithCommentOnlyUser < ::ActiveRecord::Base
64
+ self.table_name = :users
65
+ audited update_with_comment_only: false
66
+ end
67
+
47
68
  class AccessibleAfterDeclarationUser < ::ActiveRecord::Base
48
69
  self.table_name = :users
49
70
  audited
@@ -91,6 +112,7 @@ module Models
91
112
 
92
113
  class Owner < ::ActiveRecord::Base
93
114
  self.table_name = 'users'
115
+ audited
94
116
  has_associated_audits
95
117
  has_many :companies, class_name: "OwnedCompany", dependent: :destroy
96
118
  end
@@ -15,10 +15,10 @@ begin
15
15
  db_config[:configure_connection] = false
16
16
  end
17
17
  adapter = ActiveRecord::Base.send("#{db_type}_connection", db_config)
18
- adapter.recreate_database db_name
18
+ adapter.recreate_database db_name, db_config.slice('charset').symbolize_keys
19
19
  adapter.disconnect!
20
20
  end
21
- rescue Exception => e
21
+ rescue => e
22
22
  Kernel.warn e
23
23
  end
24
24
 
@@ -35,11 +35,13 @@ ActiveRecord::Schema.define do
35
35
  t.column :username, :string
36
36
  t.column :password, :string
37
37
  t.column :activated, :boolean
38
+ t.column :status, :integer, default: 0
38
39
  t.column :suspended_at, :datetime
39
40
  t.column :logins, :integer, default: 0
40
41
  t.column :created_at, :datetime
41
42
  t.column :updated_at, :datetime
42
43
  t.column :favourite_device, :string
44
+ t.column :ssn, :integer
43
45
  end
44
46
 
45
47
  create_table :companies do |t|
data/test/db/version_6.rb CHANGED
@@ -14,4 +14,6 @@ ActiveRecord::Schema.define do
14
14
  t.column :associated_id, :integer
15
15
  t.column :associated_type, :string
16
16
  end
17
+
18
+ add_index :audits, [:auditable_type, :auditable_id], name: 'auditable_index'
17
19
  end
data/test/test_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  ENV['RAILS_ENV'] = 'test'
2
2
 
3
- $:.unshift File.dirname(__FILE__)
3
+ $LOAD_PATH.unshift File.dirname(__FILE__)
4
4
 
5
5
  require File.expand_path('../../spec/rails_app/config/environment', __FILE__)
6
6
  require 'rails/test_help'
@@ -8,7 +8,6 @@ require 'rails/test_help'
8
8
  require 'audited'
9
9
 
10
10
  class ActiveSupport::TestCase
11
-
12
11
  setup do
13
12
  ActiveRecord::Migration.verbose = false
14
13
  end
@@ -79,6 +79,16 @@ class UpgradeGeneratorTest < Rails::Generators::TestCase
79
79
  end
80
80
  end
81
81
 
82
+ test "should add 'version' to auditable_index" do
83
+ load_schema 6
84
+
85
+ run_generator %w(upgrade)
86
+
87
+ assert_migration "db/migrate/add_version_to_auditable_index.rb" do |content|
88
+ assert_match(/add_index :audits, \[:auditable_type, :auditable_id, :version\]/, content)
89
+ end
90
+ end
91
+
82
92
  test "generate migration with correct AR migration parent" do
83
93
  load_schema 1
84
94
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audited
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.0
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Keepers
@@ -10,10 +10,10 @@ authors:
10
10
  - Brian Ryckbost
11
11
  - Steve Richert
12
12
  - Ryan Glover
13
- autorequire:
13
+ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2018-03-14 00:00:00.000000000 Z
16
+ date: 2021-01-08 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: activerecord
@@ -21,20 +21,20 @@ dependencies:
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: '4.0'
24
+ version: '4.2'
25
25
  - - "<"
26
26
  - !ruby/object:Gem::Version
27
- version: '5.2'
27
+ version: '6.2'
28
28
  type: :runtime
29
29
  prerelease: false
30
30
  version_requirements: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '4.0'
34
+ version: '4.2'
35
35
  - - "<"
36
36
  - !ruby/object:Gem::Version
37
- version: '5.2'
37
+ version: '6.2'
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: appraisal
40
40
  requirement: !ruby/object:Gem::Requirement
@@ -55,20 +55,34 @@ dependencies:
55
55
  requirements:
56
56
  - - ">="
57
57
  - !ruby/object:Gem::Version
58
- version: '4.0'
58
+ version: '4.2'
59
59
  - - "<"
60
60
  - !ruby/object:Gem::Version
61
- version: '5.2'
61
+ version: '6.2'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '4.0'
68
+ version: '4.2'
69
69
  - - "<"
70
70
  - !ruby/object:Gem::Version
71
- version: '5.2'
71
+ version: '6.2'
72
+ - !ruby/object:Gem::Dependency
73
+ name: rubocop
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - "~>"
77
+ - !ruby/object:Gem::Version
78
+ version: 0.54.0
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: 0.54.0
72
86
  - !ruby/object:Gem::Dependency
73
87
  name: rspec-rails
74
88
  requirement: !ruby/object:Gem::Requirement
@@ -83,6 +97,20 @@ dependencies:
83
97
  - - "~>"
84
98
  - !ruby/object:Gem::Version
85
99
  version: '3.5'
100
+ - !ruby/object:Gem::Dependency
101
+ name: single_cov
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ type: :development
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
86
114
  - !ruby/object:Gem::Dependency
87
115
  name: sqlite3
88
116
  requirement: !ruby/object:Gem::Requirement
@@ -101,30 +129,36 @@ dependencies:
101
129
  name: mysql2
102
130
  requirement: !ruby/object:Gem::Requirement
103
131
  requirements:
104
- - - "~>"
132
+ - - ">="
105
133
  - !ruby/object:Gem::Version
106
134
  version: 0.3.20
107
135
  type: :development
108
136
  prerelease: false
109
137
  version_requirements: !ruby/object:Gem::Requirement
110
138
  requirements:
111
- - - "~>"
139
+ - - ">="
112
140
  - !ruby/object:Gem::Version
113
141
  version: 0.3.20
114
142
  - !ruby/object:Gem::Dependency
115
143
  name: pg
116
144
  requirement: !ruby/object:Gem::Requirement
117
145
  requirements:
118
- - - "~>"
146
+ - - ">="
119
147
  - !ruby/object:Gem::Version
120
148
  version: '0.18'
149
+ - - "<"
150
+ - !ruby/object:Gem::Version
151
+ version: '2.0'
121
152
  type: :development
122
153
  prerelease: false
123
154
  version_requirements: !ruby/object:Gem::Requirement
124
155
  requirements:
125
- - - "~>"
156
+ - - ">="
126
157
  - !ruby/object:Gem::Version
127
158
  version: '0.18'
159
+ - - "<"
160
+ - !ruby/object:Gem::Version
161
+ version: '2.0'
128
162
  description: Log all changes to your models
129
163
  email: info@collectiveidea.com
130
164
  executables: []
@@ -132,6 +166,7 @@ extensions: []
132
166
  extra_rdoc_files: []
133
167
  files:
134
168
  - ".gitignore"
169
+ - ".rubocop.yml"
135
170
  - ".travis.yml"
136
171
  - ".yardopts"
137
172
  - Appraisals
@@ -140,12 +175,12 @@ files:
140
175
  - LICENSE
141
176
  - README.md
142
177
  - Rakefile
143
- - gemfiles/rails40.gemfile
144
- - gemfiles/rails41.gemfile
145
178
  - gemfiles/rails42.gemfile
146
179
  - gemfiles/rails50.gemfile
147
180
  - gemfiles/rails51.gemfile
148
181
  - gemfiles/rails52.gemfile
182
+ - gemfiles/rails60.gemfile
183
+ - gemfiles/rails61.gemfile
149
184
  - lib/audited-rspec.rb
150
185
  - lib/audited.rb
151
186
  - lib/audited/audit.rb
@@ -160,6 +195,7 @@ files:
160
195
  - lib/generators/audited/templates/add_comment_to_audits.rb
161
196
  - lib/generators/audited/templates/add_remote_address_to_audits.rb
162
197
  - lib/generators/audited/templates/add_request_uuid_to_audits.rb
198
+ - lib/generators/audited/templates/add_version_to_auditable_index.rb
163
199
  - lib/generators/audited/templates/install.rb
164
200
  - lib/generators/audited/templates/rename_association_to_associated.rb
165
201
  - lib/generators/audited/templates/rename_changes_to_audited_changes.rb
@@ -171,6 +207,8 @@ files:
171
207
  - spec/audited/rspec_matchers_spec.rb
172
208
  - spec/audited/sweeper_spec.rb
173
209
  - spec/audited_spec_helpers.rb
210
+ - spec/rails_app/app/assets/config/manifest.js
211
+ - spec/rails_app/app/controllers/application_controller.rb
174
212
  - spec/rails_app/config/application.rb
175
213
  - spec/rails_app/config/database.yml
176
214
  - spec/rails_app/config/environment.rb
@@ -199,7 +237,7 @@ homepage: https://github.com/collectiveidea/audited
199
237
  licenses:
200
238
  - MIT
201
239
  metadata: {}
202
- post_install_message:
240
+ post_install_message:
203
241
  rdoc_options: []
204
242
  require_paths:
205
243
  - lib
@@ -207,16 +245,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
207
245
  requirements:
208
246
  - - ">="
209
247
  - !ruby/object:Gem::Version
210
- version: '0'
248
+ version: 2.3.0
211
249
  required_rubygems_version: !ruby/object:Gem::Requirement
212
250
  requirements:
213
251
  - - ">="
214
252
  - !ruby/object:Gem::Version
215
253
  version: '0'
216
254
  requirements: []
217
- rubyforge_project:
218
- rubygems_version: 2.6.13
219
- signing_key:
255
+ rubygems_version: 3.1.4
256
+ signing_key:
220
257
  specification_version: 4
221
258
  summary: Log all changes to your models
222
259
  test_files: []
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 4.0.0"
6
- gem "protected_attributes"
7
- gem "test-unit"
8
-
9
- gemspec name: "audited", path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 4.1.0"
6
- gem "protected_attributes"
7
-
8
- gemspec name: "audited", path: "../"