Tychobra / polished

Authentication and Administration for Shiny apps
https://polished.tech
Other
233 stars 36 forks source link

Add extra information per user in Admin panel #212

Open cwilligv opened 1 year ago

cwilligv commented 1 year ago

Hi there,

I have a need to add more information about the users that get permission to access an app and I was wondering if it's possible to add extra columns like name of the user in the user creation workflow. At the moment it only takes an email. I was thinking to add a call to my database where I can store the email and name when the admin creates the user from the admin console.

In the image below I would like to add a textinput for the name and in the submit button function add a call to my database and save it there. Is that possible?

image

Thanks!

merlinoa commented 1 year ago

Hi @cwilligv

Yes, you can do this, but it would require a custom admin panel which is not super simple update. See the "custom_admin_ui" argument of secure_ui() and the "custom_admin_server" function of secure_server(). You can start by copying the default admin_app that comes with polished: https://github.com/Tychobra/polished/blob/master/R/admin_app.R and pass the the admin_ui() to the "custom_admin_ui" argument of secure_ui() and the admin_server() to the "custom_admin_server" or secure_server().

You can then customize that admin panel to do anything you want, including send additional data in your database.

cwilligv commented 1 year ago

Thank you @merlinoa , I appreciate your feedback around this. I had a look at what you've said and it's doesn't seem to be that hard, lots of updates though but you've done an excellent job with the package. I'll give it a try in the next couple of days. cheers!