obfuscate_id 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/obfuscate_id.rb +23 -5
- data/lib/obfuscate_id/version.rb +1 -1
- metadata +71 -29
- data/lib/tasks/obfuscate_id_tasks.rake +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64cbe78cad20f6cb99005995704498fedda9314c
|
4
|
+
data.tar.gz: 45018536b1d0d39375cdaa3fa62a3ab4d1865c52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6cfc54d13875e07a55e1a238fb33e1baff7480ce50fa439c27131e2cda403a58133ffa7614aa94e4a04e9fa615741838f1104ebbd0cb346731f3fd828de7401
|
7
|
+
data.tar.gz: 9c8568e7b102128ea9230595929ba80d52c057809b125fdf6575bbbc965d6934ebe1031c15fbb92ef313364166b98a75f8ad8ae5d1785589007b205caf61f789
|
data/lib/obfuscate_id.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module ObfuscateId
|
2
|
-
|
3
2
|
def obfuscate_id(options = {})
|
4
3
|
require 'scatter_swap'
|
5
4
|
|
@@ -29,8 +28,7 @@ module ObfuscateId
|
|
29
28
|
scope = deobfuscate_id(scope)
|
30
29
|
end
|
31
30
|
end
|
32
|
-
|
33
|
-
super(scope, options)
|
31
|
+
super(scope)
|
34
32
|
end
|
35
33
|
|
36
34
|
def has_obfuscated_id?
|
@@ -49,7 +47,7 @@ module ObfuscateId
|
|
49
47
|
number = name.split("").collect do |char|
|
50
48
|
alphabet.index(char)
|
51
49
|
end
|
52
|
-
number.join.to_i
|
50
|
+
number.shift(12).join.to_i
|
53
51
|
end
|
54
52
|
|
55
53
|
end
|
@@ -61,9 +59,29 @@ module ObfuscateId
|
|
61
59
|
|
62
60
|
# As ActiveRecord::Persistence#reload uses self.id
|
63
61
|
# reload without deobfuscating
|
62
|
+
# def reload(options = nil)
|
63
|
+
# options = (options || {}).merge(:no_obfuscated_id => true)
|
64
|
+
# super(options)
|
65
|
+
# end
|
66
|
+
|
64
67
|
def reload(options = nil)
|
65
68
|
options = (options || {}).merge(:no_obfuscated_id => true)
|
66
|
-
|
69
|
+
clear_aggregation_cache
|
70
|
+
clear_association_cache
|
71
|
+
fresh_object =
|
72
|
+
if options && options[:lock]
|
73
|
+
self.class.unscoped { self.class.lock(options[:lock]).find(id, options) }
|
74
|
+
else
|
75
|
+
self.class.unscoped { self.class.find(id, options) }
|
76
|
+
end
|
77
|
+
|
78
|
+
@attributes.update(fresh_object.instance_variable_get('@attributes'))
|
79
|
+
|
80
|
+
@column_types = self.class.column_types
|
81
|
+
@column_types_override = fresh_object.instance_variable_get('@column_types_override')
|
82
|
+
@attributes_cache = {}
|
83
|
+
@new_record = false
|
84
|
+
self
|
67
85
|
end
|
68
86
|
|
69
87
|
def deobfuscate_id(obfuscated_id)
|
data/lib/obfuscate_id/version.rb
CHANGED
metadata
CHANGED
@@ -1,125 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: obfuscate_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Amick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scatter_swap
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.0.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.0.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.1.8
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 4.1.8
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activeresource
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.0.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.0.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: sqlite3
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec-rails
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- -
|
73
|
+
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: capybara
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: guard-rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- -
|
101
|
+
- - ">="
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '0'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- -
|
108
|
+
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: guard-spork
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- -
|
122
|
+
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rb-inotify
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- -
|
129
|
+
- - ">="
|
116
130
|
- !ruby/object:Gem::Version
|
117
131
|
version: '0'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- -
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: launchy
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
123
165
|
- !ruby/object:Gem::Version
|
124
166
|
version: '0'
|
125
167
|
description: Make your ActiveRecord IDs non-obvious
|
@@ -129,14 +171,15 @@ executables: []
|
|
129
171
|
extensions: []
|
130
172
|
extra_rdoc_files: []
|
131
173
|
files:
|
132
|
-
- lib/obfuscate_id/version.rb
|
133
|
-
- lib/obfuscate_id.rb
|
134
|
-
- lib/tasks/obfuscate_id_tasks.rake
|
135
174
|
- MIT-LICENSE
|
136
|
-
- Rakefile
|
137
175
|
- README.md
|
176
|
+
- Rakefile
|
177
|
+
- lib/obfuscate_id.rb
|
178
|
+
- lib/obfuscate_id/version.rb
|
138
179
|
homepage: https://github.com/namick/obfuscate_id
|
139
|
-
licenses:
|
180
|
+
licenses:
|
181
|
+
- MIT
|
182
|
+
- GPL-2
|
140
183
|
metadata: {}
|
141
184
|
post_install_message:
|
142
185
|
rdoc_options: []
|
@@ -144,19 +187,18 @@ require_paths:
|
|
144
187
|
- lib
|
145
188
|
required_ruby_version: !ruby/object:Gem::Requirement
|
146
189
|
requirements:
|
147
|
-
- -
|
190
|
+
- - ">="
|
148
191
|
- !ruby/object:Gem::Version
|
149
192
|
version: '0'
|
150
193
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
194
|
requirements:
|
152
|
-
- -
|
195
|
+
- - ">="
|
153
196
|
- !ruby/object:Gem::Version
|
154
197
|
version: '0'
|
155
198
|
requirements: []
|
156
199
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.
|
200
|
+
rubygems_version: 2.2.2
|
158
201
|
signing_key:
|
159
202
|
specification_version: 4
|
160
203
|
summary: Mask ActiveRecord IDs
|
161
204
|
test_files: []
|
162
|
-
has_rdoc:
|