acts_as_secure 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/acts_as_secure.rb +6 -10
- metadata +2 -2
data/lib/acts_as_secure.rb
CHANGED
@@ -24,8 +24,7 @@ module ActiveRecord::Acts::ActsAsSecure
|
|
24
24
|
def parse_options!(options)
|
25
25
|
@secure_except = unsecure_columns(options.delete(:except))
|
26
26
|
@secure_storage_type = options.delete(:storage_type) || :binary
|
27
|
-
@
|
28
|
-
@secure_crypto_providers = {}
|
27
|
+
@secure_crypto_provider = options.delete(:crypto_provider)
|
29
28
|
fail("Unknown option(s): #{ options.keys.join(', ') }") unless options.empty?
|
30
29
|
end
|
31
30
|
|
@@ -44,7 +43,7 @@ module ActiveRecord::Acts::ActsAsSecure
|
|
44
43
|
|
45
44
|
def inherited(sub)
|
46
45
|
|
47
|
-
[:secure_except, :secure_storage_type, :
|
46
|
+
[:secure_except, :secure_storage_type, :secure_crypto_provider].each do |p|
|
48
47
|
sub.instance_variable_set("@#{ p }", instance_variable_get("@#{ p }"))
|
49
48
|
end
|
50
49
|
|
@@ -54,10 +53,11 @@ module ActiveRecord::Acts::ActsAsSecure
|
|
54
53
|
|
55
54
|
def with_crypto_provider(provider)
|
56
55
|
begin
|
57
|
-
|
56
|
+
original_provider = @secure_crypto_provider
|
57
|
+
@secure_crypto_provider = provider
|
58
58
|
yield
|
59
59
|
ensure
|
60
|
-
@
|
60
|
+
@secure_crypto_provider = original_provider
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -66,11 +66,7 @@ module ActiveRecord::Acts::ActsAsSecure
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def secure_crypto_provider
|
69
|
-
@
|
70
|
-
end
|
71
|
-
|
72
|
-
def secure_storage_id
|
73
|
-
Thread.current.object_id
|
69
|
+
@secure_crypto_provider
|
74
70
|
end
|
75
71
|
|
76
72
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: acts_as_secure
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-06-
|
6
|
+
version: 0.0.3
|
7
|
+
date: 2007-06-26 00:00:00 -04:00
|
8
8
|
summary: Adds attribute encryption to ActiveRecord models
|
9
9
|
require_paths:
|
10
10
|
- lib
|