rls_multi_tenant 0.2.4 → 0.2.6
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '08b602ae00548e9668dd3ba466c9e3feeed720c6a36aba8a6b4b592324b68670'
|
|
4
|
+
data.tar.gz: 3e45ea738d6b55461cd35c6c280a8a34f624cf5c47fc3de466b03d39a38a320b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b4415ff08af022593ad64afe9f2c1d929af6be70ce1663ba9531a5d366624e9157cd87a794ccf580721416ad77e3f3e4e1d11c0e43a2e492527a837cd0762db
|
|
7
|
+
data.tar.gz: e382dca5401c09de4a9287f75db4e3e8a91326450ba98295f2f2fb320b574032b70260a3dbc7908450c1d22fa6a095db63f213a02cb08dab72b633b5890cbf34
|
|
@@ -27,22 +27,6 @@ module RlsMultiTenant
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
|
-
|
|
31
|
-
class_methods do
|
|
32
|
-
private
|
|
33
|
-
|
|
34
|
-
def extract_tenant_id(tenant_or_id)
|
|
35
|
-
case tenant_or_id
|
|
36
|
-
when RlsMultiTenant.tenant_class
|
|
37
|
-
tenant_or_id.id
|
|
38
|
-
when String, Integer
|
|
39
|
-
tenant_or_id
|
|
40
|
-
else
|
|
41
|
-
raise ArgumentError,
|
|
42
|
-
"Expected #{RlsMultiTenant.tenant_class_name} object or tenant_id, got #{tenant_or_id.class}"
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
30
|
end
|
|
47
31
|
end
|
|
48
32
|
end
|
|
@@ -84,7 +84,7 @@ module RlsMultiTenant
|
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
def extract_subdomain(host)
|
|
87
|
-
return nil if host.blank?
|
|
87
|
+
return nil if host.blank? || ip_host?(host)
|
|
88
88
|
|
|
89
89
|
# Remove port if present
|
|
90
90
|
host = host.split(':').first
|
|
@@ -97,6 +97,10 @@ module RlsMultiTenant
|
|
|
97
97
|
|
|
98
98
|
parts.first
|
|
99
99
|
end
|
|
100
|
+
|
|
101
|
+
def ip_host?(host)
|
|
102
|
+
!/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/.match(host).nil?
|
|
103
|
+
end
|
|
100
104
|
end
|
|
101
105
|
end
|
|
102
106
|
end
|