msgphp / symfony-demo-app

A Symfony demo application with basic user management
https://github.com/msgphp/msgphp
MIT License
0 stars 0 forks source link

User emails table can be changed from another application? #64

Closed crabnky closed 6 years ago

crabnky commented 6 years ago

Hi, Regarding the multiple email login - what if we have another application using the same database, which can modify user emails table? In such case the changes won't be reflected in the username table, right?

ro0NL commented 6 years ago

If you modify the table directly, then no. In that case you can run bin/console user:synchronize:usernames.

Otherwise, when using the ORM itself, it's synced by default using the entity listener: https://github.com/msgphp/msgphp/blob/master/src/User/Infra/Doctrine/Event/UsernameListener.php

crabnky commented 6 years ago

I see. And when I remove the username_lookup from config the username table won't be used at all, right? Can I use the username table, but get rid of UsernameListener? I would take care about the username table myself - just want application only to READ from username table, not to write anything.

ro0NL commented 6 years ago

@crabnky yes, that's what https://github.com/msgphp/msgphp/pull/197 is about :) it allows to enable/define the Username entity in your app, without configuring username_lookup (for Doctrine).

crabnky commented 6 years ago

Uh, the last item in https://github.com/msgphp/msgphp/issues/196 solves my problem I think. I overlooked this, sorry. :( When do you expect this to be released?

ro0NL commented 6 years ago

aiming for it this Wednesday :)

Currently username_lookup is only handled by doctrine, so configuring e.g. msgphp_user.doctrine.sync_usernames: false would be the same as not configuring the username_lookup.

But for future purposes it should be possible to enable the username lookup and disable doctrine handling.

ro0NL commented 6 years ago

see 0.7@dev