Is it possible to check if a user has access to a specific application using email and uuid?

I'm building a homepage app that will show all the links to all the apps that the logged in user has access to. So far, I have ListView's and LinkList's creating the links dynamically, but I need to filter the links, removing those that the user cannot access. My question is, how can I check this inside a js resource, using a function for example?

Hi @Doglas

Thanks for reaching out!

It looks like you are reaching out about a self-hosted/on-premise instance of Retool. If that's true, you should be able to use the Retool database to query which apps the end user has access to. As is described in this Retool community post, you may consider adding your on-prem Retool instances backing database as a resource within your organization, then query the users table within your apps as needed. For your use case, you'd likely want to query and join data from the groups, user_groups, users, pages, folders, and group_pages tables.

Please kindly note that this solution should be implemented with significant caution in production environments; having the backing database available as a resource may pose issues if not carefully managed (data being inadvertently updated or deleted, the database being over-utilized, etc.). As such, if you choose this solution, here are a few considerations/recommendations:

  • Add the database resource using a read-only database user credentials.
  • Ensure that your database has the necessary back-up and restore functionality.
  • Ensure that the database resource permissions are tightly scoped within your Retool organization.

All plan levels/apps on Retool, have access to the {{current_user}} object, which allows you call information about the end user (such as email, id, which permission groups they're in, etc).

For users that are on Cloud, you could technically maintain a list of apps that each permission group has access to & then use JS to cross check that with the {{current_user}}'s permission groups. Of course, this takes more effort to maintain as apps are created.

For all users, we have a feature request on file to make this data more easily queryable. I'll post here if I get any updates!