mongoid-kms 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mongoid/kms.rb +1 -5
- data/lib/mongoid/kms/version.rb +1 -1
- data/spec/lib/mongoid/kms_spec.rb +15 -0
- data/spec/spec_helper.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cffedc1b6fdd40f2acea4724eb5cb66ed2b94bc2
|
4
|
+
data.tar.gz: f9cace49c7fcbaa841fb63227e4b092af17fce2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a12c1f303e1a6ff655b2aff35dc6aff21e133129834534999199abfa5af5e87535caaa493e7d4edcaf39cf87ff7a2305dff04b8cb5e7f8cca0e24d7ffc9ae03
|
7
|
+
data.tar.gz: 843812d2f3b1756cb8131f6ca9f38a224390d8a1921482b9c667875ad46d799584841d40e9caec255165b75184170cec21f7a00f5f15e66baa23749101238623
|
data/lib/mongoid/kms.rb
CHANGED
@@ -9,10 +9,6 @@ module Mongoid
|
|
9
9
|
included do
|
10
10
|
class_attribute :kms_field_map
|
11
11
|
self.kms_field_map ||= {}
|
12
|
-
|
13
|
-
unless self.ancestors.include?(ActiveModel::Dirty)
|
14
|
-
include ActiveModel::Dirty
|
15
|
-
end
|
16
12
|
end
|
17
13
|
|
18
14
|
@configuration = {}
|
@@ -144,7 +140,7 @@ module Mongoid
|
|
144
140
|
def secure_field(field_name, args)
|
145
141
|
encrypted_field_name = get_encrypted_field_name(field_name)
|
146
142
|
|
147
|
-
|
143
|
+
create_dirty_methods field_name, field_name
|
148
144
|
before_save :set_kms_values
|
149
145
|
|
150
146
|
kms_field_map[field_name.to_s] = {context: args.delete(:context), type: args[:type]}
|
data/lib/mongoid/kms/version.rb
CHANGED
@@ -58,6 +58,21 @@ describe Mongoid::Kms do
|
|
58
58
|
|
59
59
|
o = ExtendedClass.find(o.id)
|
60
60
|
expect(o.additional_secure).to eq("wha!")
|
61
|
+
o.test_hash_crash
|
62
|
+
end
|
63
|
+
|
64
|
+
it "works fine with Mongoid + Hash" do
|
65
|
+
class TestHashClass
|
66
|
+
include Mongoid::Document
|
67
|
+
include Mongoid::Kms
|
68
|
+
|
69
|
+
secure_field "other", type: String, context: ["hammertime"]
|
70
|
+
field :bla, type: Hash
|
71
|
+
end
|
72
|
+
|
73
|
+
o = TestHashClass.create!(bla: {name: "samson"})
|
74
|
+
o = TestHashClass.find(o.id)
|
75
|
+
o.bla
|
61
76
|
end
|
62
77
|
|
63
78
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -27,11 +27,12 @@ class ClassWithoutContext
|
|
27
27
|
include Mongoid::Kms
|
28
28
|
|
29
29
|
secure_field :secure, type: String
|
30
|
-
field :unsecure
|
30
|
+
field :unsecure, type: Hash
|
31
31
|
end
|
32
32
|
|
33
33
|
class ExtendedClass < OtherClass
|
34
34
|
secure_field :additional_secure, type: String, context: [:unsecure, :timestamp]
|
35
|
+
field :test_hash_crash, type: Hash, default: {}
|
35
36
|
end
|
36
37
|
|
37
38
|
Mongoid::Kms.configure({region: "us-east-1", key: ENV['AWS_KMS_KEY_ID']})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-kms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Winslett
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|