FriendsOfSymfony / FOSUserBundle

Provides user management for your Symfony project. Compatible with Doctrine ORM & ODM, and custom storages.

Home Page:https://symfony.com/doc/master/bundles/FOSUserBundle/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] 'non-advanced' FosUser?

stephanvierkant opened this issue · comments

In the master branch, the fields of AdvancedUserInterface have been added to the UserInterface. This is a workaround to get rid of the deprecation notices, but doesn't follow the latest best practices:

https://symfony.com/blog/new-in-symfony-4-1-deprecated-the-advanceduserinterface:

One of our ongoing goals for security is to simplify some of its features. (..) Given that these methods are mostly related to your application domain logic, we've decided to deprecate it in Symfony 4.1 and remove it in Symfony 5.0. No alternative is provided for this interface. If you need this kind of checks, create a user checker, which perform additional checks during the authentication of a user to verify if the identified user is allowed to log in.

I've never used the methods in AdvancedUserInterface and used the User checkers instead. To use this bundle, I've to implement some fields I never use.

I think we should get rid of those fields in FOSUserBundle/Model/UserInterface and create a (deprecated) FOSUserBundle/Model/AdvancedUserInterface for backwards compatibility. What do you think?

This deprecation has been already fixed: #2815

No, that's my point: it's not really fixed, the fields just have been moved. That's why I said

This is a workaround to get rid of the deprecation notices, but doesn't follow the latest best practices.

What's the problem? There are no new fields, just new methods. It means a breaking change if this methods are getting removed. For more information about this, take a look in the linked PR above.

Edit:
Btw. Those methods are not new since there are also existing in the regular AdanvcedUserInterface which was the base interface in the previous revision of the UserInterface in the FOSUserBundle

There is no problem if you only look at deprecation/error notices. But it doesn't follow the latest best practices:

(..) Given that these methods are mostly related to your application domain logic, (..)

I want to use FOSUserBundle, but I don't need those fields. Why should my application and database contain those fields? I think there should be a way of using this bundle without those opinionated fields. See #2686 and #2845. Symfony's AdvancedUserInterface has been deprecated for a good reason.

I've removed FOSUserBundle completely.