Hello,
I'm looking for a suggested solution to prevent having a Create Account form show, I'd rather the user already managed by the base application be allowed, based on permission, to have a proper user automatically in the waterhole authorization system..
I was thinking of having a middleware run for the Waterhole routes that will add the desired user to the waterhole users table in the case of accessing with a "new" Laravel user. Unless there is something already in waterhole that has eluded me so far.
Thank you,
James
7 Comments
Hi @James Pence,
Have you closely followed the integration docs for authentication?
It seems it gets you covered here: https://waterhole.dev/docs/main/laravel#authentication
Cheers,
I did and the toWaterholeUser function is getting the values to populate the form, but the form is still showing and expecting the Create Account submission button to be pressed to actually add the user to the waterhole users table.
Hi @James Pence, this is a current limitation of the Laravel auth integration, to be added in a future release. Your proposed workaround sounds reasonable - let me know how this goes, here to answer any questions if needed.
You can do something like this:
On your registration form/admin user page, you can add waterhole user after you created your base user.
Update the columns base on your needs. You can even add them to a specific group.
You can add a listener/observer to always sync them on created/updated/deleted etc.
The solution I came to was checking in the toWaterholeUser function before returning the PendingUser. If there is no waterholeUser then I add the waterholeUser with the proper roles based on the permissions from the regular application's "spatie/laravel-permission" system.
Looks good. Could you share your code?
I created a simplified pair of models in my namespace WaterholeUser and WaterholeRole. they correspond to User and Group within waterhole.
I also have permissions of "forum_use", and "forum_manage" assigned to roles in the main app.