-
Notifications
You must be signed in to change notification settings - Fork 0
Let the application decide whether to create an app instance #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
e7ac921 to
55f17c2
Compare
mpetrowi
left a comment
There was a problem hiding this 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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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.