zerodine / MongoDBAclBundle

This bundle allows the use of MongoDB as the storage layer for the Symfony ACLs component.
21 stars 32 forks source link

Choosing the mongoId for the UserSecurityIdentity #21

Open monbro opened 11 years ago

monbro commented 11 years ago

When it comes to the case, that a user wants to change his username / email address, all the previous granted permissions gonna be lost.

Wouldnt it be nice to allow a selection between the username / email and MongoId of the user document?

iampersistent commented 11 years ago

Yes this makes sense to me. I'm not sure when I would get around to doing it, but you are welcome to put in a PR for it.

monbro commented 11 years ago

Well I covered my head around that yesterday and figured out, that you will need to create a new UserSecurityIdentity.php which will work with the Id instead of the Email / Name. As well to change that for the MutableAclProvider.php. You can have a look to my last 3 commits here: https://github.com/monbro/MongoDBAclBundle (Hacky / Proof of concept solution in here)

But as we decided not go any further with ACL at all I will not put any more work into this, sorry for that. But I will leave my fork in case it might help you.

Just to note: A big problem I spotted out was, that when SF2 tries to match the in the DB stored ACL information against a logged in user, it will still use its very own MutableAclProvider.php from the SF2 components and not the one from the MongoDBAclBundle Bundle. Something that would help seems to be http://symfony.com/doc/current/cookbook/bundles/inheritance.html or http://symfony.com/doc/current/cookbook/bundles/override.html.

Hope that helps.