Hey @chrismaden!
It's possible to reference the values in {{ currentUser }}
and {{ retoolContext }}
from your resource setup page. For instance, you could define a database to access based on {{ retoolContext.environment }}
and then pass {{ currentUser.email }}
as the database user.
Apart from that, there's an experimental feature that allows you to dynamically specify which resource a query uses. With that, you could create a separate resource for each database and switch between them in the app based on user information.
Finally, you might also explore using Row Level Security with a single database as an alternative way to segment accessible information between different users.
Do any of those three options seem like they might work?