Skip to content

Conversation

@dspencer001
Copy link
Contributor

Instead of erroring, permit the application to intervene and create an application instance. This lets us create tenants better in the case of dynamic registration installs, where we don't necessarily have the information necessary to create the application instance immediately.

These come after the custom and default strategies, and can be used by the application to optionally create new ApplicationInstance records on launch, or do something else in the case where we weren't able to find the ApplicationInstance record for the LTI launch.
@dspencer001 dspencer001 force-pushed the ds/permit-dynamic-tenant-creation branch from e7ac921 to 55f17c2 Compare October 8, 2025 13:05
Copy link
Contributor

@mpetrowi mpetrowi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I like that we're using the existing strategies

The application will still have to provide a custom strategy, but at least most of the logic is contained in the gem now.
gsub(/[^\w]+/, "_") # Replace non alphanumeric characters with _

old_tenant = "#{site_key}-#{current_application.key}"
app_instance = ApplicationInstance.find_by(tenant: old_tenant, application: current_application)
Copy link
Contributor

@mpetrowi mpetrowi Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check the new style first and then fall back to legacy search using a method that can be defined in the ap? AA might need extra logic here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this just has to be all custom by the application. The new tenant system that replaces Apartment has tenant as belongs_to, not just a field, so this wouldn't work for those applications

Also moves more to be implemented by the application.
find_existing is redundant, so is create_new. Instead call it exactly what we're finding/creating
@dspencer001 dspencer001 merged commit d3db463 into main Oct 10, 2025
2 of 3 checks passed
@dspencer001 dspencer001 deleted the ds/permit-dynamic-tenant-creation branch October 10, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants