Open source ORM with access control for PHP
I have a number of projects (some commercial, some not) in which both field- and resource-level access are needed. Naturally, it would be nice to use and contribute to an ORM project rather that re-inventing the wheel, but I've not been able to find a project with any kind of access control layer; it seems most of them leave that up to the domain 开发者_Go百科objects, and those classes cannot inherit from a super class.
It may be possible to fork Doctrine--but again, I'd prefer not to dive in solo.
My choice as ORM has always been Propel (v1.5), I find it lighter, faster and easier to understand. It also has custom behaviors, which could be the starting phase of your access control plugin, at least for resources.
You can see some docs on behaviors here, and this wiki explains pretty well how to build your own.
Hope I can help
Creating a DB structure for user access control, and building the code that will make the defined rules effective, is not the ORM job (it will help you to do it, but it won't do it for you).
However this need of access control is frequent (named ACL or RBAC; it seems that you're looking for an ACL), and some projects have already emerged, which create all the DB structure for that, for example sfGuard (Symfony) or Zend_ACL (Zend Framework).
Check those SO threads too:
- Building a generic OO ACL using Doctrine
- how to get role from Zend_Auth/Zend_ACL when using a Doctrine adapter? getting all work together
精彩评论