Admin account to select and appear as normal user

Hi All,

I’ve built my app to make extensive use of the anvil.users.get_user() functionality to keep all the available content and manipulation of the app secure to just ‘their space’ and separate out everything per user as per the fantastic Anvil tutorials for multi-user apps. Through market research it now appears that in the early days its probably going to be the case that I make most of the manipulations (uploading content, changing values etc.) instead of my early users and it now occurs to me that I need to create an ‘admin layer’ over everything I’ve built. I was wondering if Anvil has anything smart built in that would allow an Admin account to change the user it represents somewhere in the app so that I can view the front end as if I am a chosen normal user?

I could probably build everything I need to by going through literally every function and changing the inputs to be dependent on whether its an admin account or not and making additional inputs available on every form conditionally - but I would hate to have to do that :’( so I am basically asking if Anvil has anything tasty in this area?

Thanks,

James

Nothing is built-in to automatically pose as certain users as far as I know. However, there are probably lots of ways to do this depending on how your app is designed.

I’m no expert but I’ve been using a type of role based access control for my apps. The app changes its content and functionality based on the role rather than the user. This way, if I want to “be” a certain user, I simply take their role and re-login.

It’s a deep topic but I read these docs to get me started when designing my app:

I hope this helps and good luck.

1 Like