consuldemocracy / consuldemocracy

Consul Democracy - Open Government and E-Participation Web Software

Home Page:https://consuldemocracy.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multitenancy errors when updating a tenant domain name

Senen opened this issue · comments

User Story

When a Consul Democracy administrator changes the domain of a tenant, the files uploaded through active storage cannot be found. The files are in the server but within the previous domain folder. A temporary workaround is to rename the tenant's active storage old folder to use the new domain name by hand.

A similar thing happens with the authentication logs, which also use the domain name to create a folder for the authentication logs for that tenant. There is no data loss, but we will have two different authentication log files for the same tenant, one with the old name and another with the new name.

Why is this Needed?

To allow administrators to change the tenant domain without additional issues to consider.

Description

Type: Bug

Current Behavior

When a Consul Democracy administrator changes the domain of a tenant, the files uploaded through active storage cannot be found as they live under the old domain folder.

A similar thing happens with the authentication logs, which also use the domain name to create a folder for the authentication logs for that tenant.

Expected Behavior

  1. Administrators can change a tenant's domain name without losing the location of the tenant's active storage files.
  2. Administrators can change a tenant's domain name without creating a new folder for the authentication logs.

Steps to reproduce the ActiveStorage issue

  1. Enable multitenancy
  2. Create a tenant with a domain name
  3. Upload a document or image to any model
  4. Check the image or document uploaded is available
  5. Change the tenant domain name
  6. The image or document uploaded is not available anymore

Steps to reproduce the authentication logs issue

  1. Enable multitenancy
  2. Enable authentication logs
  3. Create a tenant with a domain name
  4. Try to log in to the application (no matter if the login succeeds or fails, as both cases are recorded)
  5. Change the tenant domain name
  6. Try to log in to the application again (no matter if the login succeeds or fails, as both cases are recorded)
  7. You should find two different folders within the log directory for the same tenant.