What would be the best approach to add admin role to user while using Bodyguard?
Should I grant admin role to first registered user?
How are you deploying your application? It should be easy to get an IEx session running connected to your live application and just set the role manually. I wouldn’t want to add custom logic/code to automatically grant admin permissions.
1 Like
This is often exactly the usecase for priv/seeds.exs
1 Like
Checkout how it’s done in Plausible!
Basically the first account you create will be a super admin, which will be supplied via environment variable!
Something like:
SUPER_ADMIN_IDS
SUPER_ADMIN_NAME
So no one at run time can just modify a database role and pretend to be super admin.