mumukit-platform 6.0.0 → 6.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/mumukit/platform/organization_mapping.rb +26 -1
- data/lib/mumukit/platform/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aa8d319e6390b781d8da0e7d33f720cf6b093c0d43ba432ca27666da514191d
|
4
|
+
data.tar.gz: d124ebd5601c68dcdb97a51de9a0a42319a3f0d83a92a88ab1aa2b8198d8d514
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97fd564e02205ec571c81b12560fa1939dd03bd5cd651ecd17b09c670602ca4a06e8564ee171f6042219fd8f5327974988155611a85c6791b447a3d4536a81d4
|
7
|
+
data.tar.gz: 99c5f0bed18cad1bb402e47371a16ab9b4e9e641471ffaa8414901b55702771df1239f47ab809b0b0333caa40b5e6b071e118301e9e15f67b49a0a3b7e1444fe
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
1
3
|
module Mumukit::Platform::OrganizationMapping
|
2
4
|
def self.from_env
|
3
5
|
if ENV['RACK_ENV'] == 'test' || ENV['RAILS_ENV'] == 'test'
|
@@ -18,7 +20,15 @@ module Mumukit::Platform::OrganizationMapping
|
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
23
|
+
module Base
|
24
|
+
def path_for(request)
|
25
|
+
request.path_info
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
21
29
|
module Subdomain
|
30
|
+
extend Base
|
31
|
+
|
22
32
|
def self.implicit_organization?(request, domain)
|
23
33
|
request.empty_subdomain_after?(domain)
|
24
34
|
end
|
@@ -38,9 +48,15 @@ module Mumukit::Platform::OrganizationMapping
|
|
38
48
|
def self.path_under_namespace?(_organization_name, path, namespace)
|
39
49
|
path.start_with? "/#{namespace}/"
|
40
50
|
end
|
51
|
+
|
52
|
+
def self.inorganic_path_for(request)
|
53
|
+
path_for(request)
|
54
|
+
end
|
41
55
|
end
|
42
56
|
|
43
57
|
module Path
|
58
|
+
extend Base
|
59
|
+
|
44
60
|
def self.implicit_organization?(_request, _domain)
|
45
61
|
false
|
46
62
|
end
|
@@ -49,8 +65,17 @@ module Mumukit::Platform::OrganizationMapping
|
|
49
65
|
framework.configure_tenant_path_routes! native, &block
|
50
66
|
end
|
51
67
|
|
68
|
+
def self.path_composition_for(request)
|
69
|
+
organization, *path_parts = Pathname(path_for(request)).each_filename.to_a
|
70
|
+
[organization, path_parts.join('/')]
|
71
|
+
end
|
72
|
+
|
52
73
|
def self.organization_name(request, _domain)
|
53
|
-
request.
|
74
|
+
path_composition_for(request).first
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.inorganic_path_for(request)
|
78
|
+
path_composition_for(request).second
|
54
79
|
end
|
55
80
|
|
56
81
|
def self.organic_uri(uri, organization)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit-platform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit-nuntius
|