Symfony2 ACL and pager/multiple entities filtering

前端 未结 1 2032
梦如初夏
梦如初夏 2021-02-08 13:47

I\'ve seen examples of ACL to deal with one entity but none to deal with fetching multiple items - such as a list of posts that belong to an author. One (bad) suggestion was to

1条回答
  •  南笙
    南笙 (楼主)
    2021-02-08 14:00

    I think, you shouldn't use ACL for determining which posts belong to a particular author because ACL is about access control / permissions, not about finding owners or determining object relations.

    But certainly, you are perfectly ok to want to get a list of posts certain user can view, edit or moderate for example.

    Currently, there is no functionality to do this on API level, but... well, I think in Symfony2 / Doctrine2 you can just do Native Query and join with acl_entries table.

    But there is a drawback. In a large system acl_entries table will contain just too much rows and joining against it can be slow (we know, that MySQL is stupid sometimes). So you might also want to build some kind of caching system around this.

    0 讨论(0)
提交回复
热议问题