effective_obfuscation 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/models/concerns/acts_as_obfuscated.rb +5 -5
- data/lib/effective_obfuscation/version.rb +1 -1
- data/lib/effective_obfuscation.rb +13 -0
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 136beb68fd38439dfe0d5904a5e0e6dd353b939a
|
4
|
+
data.tar.gz: a39e154c154df56f985d28bcb8c321491640959d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2557b83c462eccf88a25c9bfecaaffadd671c36d19cfec9e9b276aeb5ccf9a2da4452b3a49d876edbe2b005acae6c4f9059aca99e00f5a1d2ec9ee56103ca82c
|
7
|
+
data.tar.gz: eb7f98b1704d724814057648ded7c3dc5ee0fff97cdc62329b71001c2371ae6bb03100a4e7229db14d9c9b6635ad3b1a91fa2a8c48a9fc3b43d894e6e5f27ebf
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ This is a Rails 4 compatible version of obfuscate_id (https://github.com/namick/
|
|
33
33
|
Add to Gemfile:
|
34
34
|
|
35
35
|
```ruby
|
36
|
-
gem 'effective_obfuscation'
|
36
|
+
gem 'effective_obfuscation'
|
37
37
|
```
|
38
38
|
|
39
39
|
Run the bundle command to install it:
|
@@ -53,9 +53,7 @@ module ActsAsObfuscated
|
|
53
53
|
} { |parent| parent.table[:id] }
|
54
54
|
end
|
55
55
|
|
56
|
-
|
57
|
-
extend FinderMethods
|
58
|
-
end
|
56
|
+
extend FinderMethods if EffectiveObfuscation.extend_klass?
|
59
57
|
end
|
60
58
|
|
61
59
|
module ClassMethods
|
@@ -113,7 +111,7 @@ module ActsAsObfuscated
|
|
113
111
|
acts_as_obfuscated_opts[:max_id] ||= (self.unscoped.maximum(:id) rescue 2147483647)
|
114
112
|
end
|
115
113
|
|
116
|
-
if
|
114
|
+
if EffectiveObfuscation.extend_relation?
|
117
115
|
def relation
|
118
116
|
super.tap { |relation| relation.extend(FinderMethods) }
|
119
117
|
end
|
@@ -122,7 +120,9 @@ module ActsAsObfuscated
|
|
122
120
|
|
123
121
|
module FinderMethods
|
124
122
|
def find(*args)
|
125
|
-
|
123
|
+
if @_effective_obfuscation_reloading || (respond_to?(:klass) && klass.try(:instance_variable_get, :@_effective_obfuscation_reloading))
|
124
|
+
return find_by_id(args.first)
|
125
|
+
end
|
126
126
|
|
127
127
|
super(deobfuscate(args.first, false))
|
128
128
|
end
|
@@ -10,4 +10,17 @@ module EffectiveObfuscation
|
|
10
10
|
def self.show(id, spin)
|
11
11
|
::ScatterSwap.reverse_hash(id, spin).to_i
|
12
12
|
end
|
13
|
+
|
14
|
+
def self.extend_klass?
|
15
|
+
return false if Gem::Version.new(Rails.version) < Gem::Version.new('4.2')
|
16
|
+
return true if Gem::Version.new(Rails.version) >= Gem::Version.new('5.1')
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.extend_relation?
|
21
|
+
return true if Gem::Version.new(Rails.version) < Gem::Version.new('4.2')
|
22
|
+
return true if Gem::Version.new(Rails.version) >= Gem::Version.new('5')
|
23
|
+
false
|
24
|
+
end
|
25
|
+
|
13
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_obfuscation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,9 +38,8 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.0.3
|
41
|
-
description: Display unique 10-digit numbers instead of ActiveRecord IDs.
|
42
|
-
ID param so curious website visitors are unable to determine your
|
43
|
-
count.
|
41
|
+
description: Display unique 10-digit numbers instead of ActiveRecord IDs. Hides the
|
42
|
+
ID param so curious website visitors are unable to determine your resource count.
|
44
43
|
email:
|
45
44
|
- info@codeandeffect.com
|
46
45
|
executables: []
|
@@ -73,9 +72,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
72
|
version: '0'
|
74
73
|
requirements: []
|
75
74
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.4.
|
75
|
+
rubygems_version: 2.4.6
|
77
76
|
signing_key:
|
78
77
|
specification_version: 4
|
79
|
-
summary: Display unique 10-digit numbers instead of ActiveRecord IDs.
|
80
|
-
param so curious website visitors are unable to determine your
|
78
|
+
summary: Display unique 10-digit numbers instead of ActiveRecord IDs. Hides the ID
|
79
|
+
param so curious website visitors are unable to determine your resource count.
|
81
80
|
test_files: []
|