Module: Mumukit::Platform::OrganizationMapping::Path

Extended by:
Base
Defined in:
lib/mumukit/platform/organization_mapping.rb

Class Method Summary collapse

Methods included from Base

path_for

Class Method Details

.implicit_organization?(_request, _domain) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/mumukit/platform/organization_mapping.rb', line 60

def self.implicit_organization?(_request, _domain)
  false
end

.inorganic_path_for(request) ⇒ Object



77
78
79
# File 'lib/mumukit/platform/organization_mapping.rb', line 77

def self.inorganic_path_for(request)
  path_composition_for(request).second
end

.map_organization_routes!(native, framework, &block) ⇒ Object



64
65
66
# File 'lib/mumukit/platform/organization_mapping.rb', line 64

def self.map_organization_routes!(native, framework, &block)
  framework.configure_tenant_path_routes! native, &block
end

.organic_uri(uri, organization) ⇒ Object



81
82
83
# File 'lib/mumukit/platform/organization_mapping.rb', line 81

def self.organic_uri(uri, organization)
  uri.tenantize organization, fragmented: true
end

.organization_name(request, _domain) ⇒ Object



73
74
75
# File 'lib/mumukit/platform/organization_mapping.rb', line 73

def self.organization_name(request, _domain)
  path_composition_for(request).first
end

.path_composition_for(request) ⇒ Object



68
69
70
71
# File 'lib/mumukit/platform/organization_mapping.rb', line 68

def self.path_composition_for(request)
  organization, *path_parts = Pathname(path_for(request)).each_filename.to_a
  [organization, path_parts.join('/')]
end

.path_under_namespace?(organization_name, path, namespace) ⇒ Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/mumukit/platform/organization_mapping.rb', line 85

def self.path_under_namespace?(organization_name, path, namespace)
  path.start_with? "/#{organization_name}/#{namespace}/"
end