I wonder what is the best way to manage users in a home-structured CMS. Important feature that needs to be include is obviously security.
I heard about UserCake and it seems to be a fair idea.
The questions is: should I make it myself or should I use a user script already made?
If the library fits your need, use it.
If the library almost fits your need, consider cloning it and make the minor changes to it [and providing a pull request, if your additions are worth].
If desired feature is part of you business core [i.e. you want to make money out of it], consider rewriting it from scratch.
But for such a feature, I would go for an existing tool - Symfony does the same with FOSUserBundle for example.