Note we aren't allowing to delete a tenant because it would delete all its data, so this action is a very dangerous one. We might need to add a warning when creating a tenant, indicating the tenant cannot be destroyed. We can also add an action to delete a tenant which forces the admin to write the name of the tenant before deleting it and with a big warning about the danger of this operation. For now, we're letting administrators of the "main" (default) tenant to create other tenants. However, we're only allowing to manage tenants when the multitenancy configuration option is enabled. This way the interface won't get in the way on single-tenant applications. We've thought about creating a new role to manage tenants or a new URL out of the admin area. We aren't doing so for simplicity purposes and because we want to keep CONSUL working the same way it has for single-tenant installations, but we might change it in the future. There's also the fact that by default we create one user with a known password, and if by default we create a new role and a new user to handle tenants, the chances of people forgetting to change the password of one of these users increases dramatically, particularly if they aren't using multitenancy.
19 lines
311 B
Ruby
19 lines
311 B
Ruby
class Admin::Tenants::IndexComponent < ApplicationComponent
|
|
include Header
|
|
attr_reader :tenants
|
|
|
|
def initialize(tenants)
|
|
@tenants = tenants
|
|
end
|
|
|
|
def title
|
|
t("admin.menu.multitenancy")
|
|
end
|
|
|
|
private
|
|
|
|
def attribute_name(attribute)
|
|
Tenant.human_attribute_name(attribute)
|
|
end
|
|
end
|