Current_user.id table

Retool has a global variable called current_user and there is a number for the values for current_user.id

Where is this number coming from?
How can I access this table? (My goal is to get a mapping of the current_user.id and the logged in user's email or name)

The self-hosted packages only access the user database, I know. So, you can't access the table; you can only access {{ current_user }} variable in a Retool App.

You can get a lot of info using current_user
Screenshot 2022-12-09 at 10.34.06 AM

Thank you, @celil
That is unfortunate that only self-hosted Retool has access to the table.

Thank you, @ScottR
One temporary solution, I'm currently using is to log both current_user.id and current_user.email, so that after some time, I'll have the table I'm looking for.

There's also a feature request for accessing more user data that you can follow along with here!

Any changes on this front in 2 years?

Or there is another way to implement Attribute-Based Access Control
as Role-Based Access Control that's there does not suit my needs for content separation.

Hello @Scottsky!

Currently only users with an Enterprise Plan have access to the Retool API which can be used to access the data of all users of an app, to then pull out user IDs and emails as mentioned above by Luigi for their use case.

Could you elaborate more on how you would like to assign attribute based permissions and how these permissions would differ from the current role-based permissions? If you could give some examples for what content you want to have separation for different users as well that would be very helpful for me to help you find the right potential solution.

If you are looking to have more granular control over who can use/edit/own features in a Retool such as apps, resources and workflows, you can read further about this on the docs here as these greater controls are limited to business and enterprise plan users but should solve most use cases for content separation.

Appreciate you looping back on this.

As I was setting up access control in my app that has a pretty complex organisations/projects/users/assets ecosystem meant to serve different users content per there respected access level. And stumbling upon {{current_user.id}} I obviously thought of it as a perfect way of telling users apart. Only after discovering that the rest of the table is not available in my tear I looked in to the solution presented here. That actually worked for me as good as IDs would. But just in case something changed in 2 years that I'm not aware of I asked the question.

I ended up using emails and assess tables within the app. And save retool roles for something like lower level app administrating.

@Scottsky Glad to hear you were able to find a workaround!

Let me know if you have any other questions :slight_smile: