The PartKeepr user system seems a bit strange at first glance. There is a
PartKeeprUser table and a
FOSUser table, which seems redundant. However, that's not the case.
PartKeepr supports different Symfony user providers. A user provider may be an LDAP User Provider, or the built-in
FOSUser, or any other user provider you might wish to configure. However, there's one problem with all those different user providers: Not all of them have an actual entry in the PartKeepr database. So we need a way to map users to a database entry, which needs to be a single entity and entry.
A basic example illustrates the problem:
- An user removes stock from a part
- We need to store the user who removed the stock
- In case of LDAP users, we don't have an entry in the database
PartKeeprUsers: The proxy table
PartKeeprUser is the proxy user table. This table contains all mappings from a specific username and provider. That concept also allows to have users with the same username for different user providers.
PartKeeprUsers: The legacy user table
Because PartKeepr was not based on Symfony2, legacy username and passwords (pre PartKeepr 0.75) are stored within
PartKeeprUsers as well. The most elegant solution would be to migrate all legacy users to the new
FOSUser table. However, that's not possible because:
- The FOSUser bundle uses a different password storage format
- The FOSUser bundle requires each user to have a password
Due to that fact, the PartKeepr legacy user provider was implemented.