fief-dev / fief

Users and authentication management SaaS
https://www.fief.dev
Other
488 stars 42 forks source link

Granted by default roles are processed in the worker, so it's not working as expected on first login #228

Closed frankie567 closed 4 months ago

frankie567 commented 1 year ago

Roles have a granted by default feature allowing workspace admin to grant a role automatically to new users as they register. It's useful so we're sure a user have a basic set of permissions right away.

However, the current implementation does this work asynchronously in the background worker (inside OnAfterRegisterTask). This is not very convenient because, when the new user is redirected to the application, the access token generated won't have the default permissions, as the worker probably didn't process the task yet.

We need to improve the implementation so those default roles/permissions are added right away after registration. It might add a bit of overhead in the request, but it would be much more consistent and sensible for the end-developer.

Upvote & Fund

Fund with Polar