douju3911 2015-01-06 13:25
浏览 50
已采纳

更新Symfony2中的安全标识(ACL)

I'm using FOSUserBundle to handle my app users. Users can update their usernames or either get deleted by an administrator. Everything is fined on that part, my problem is related to Symfony ACL.

Each user has its own security entity when it's created. For example, if I create an account with shigeno username, it results in something like this in database (acl_security_identities table):

id   | identifier                    | username
...  | ...                           | ...
23   | my\Bundle\Entity\User-shigeno | 1

(ACL identity uses the username! Ouch... Why not the id?)

Now, I, shigeno, change my username to honda. Acl_security_identities table stays as it is, so all my permission are removed (or, more precisely, they didn't moved with me).

Sure, I can add new ACLs. But:

  1. It's painful. I have to get all previous ACL to duplicate, not to mention that I don't have easy access to all security objects when I update or remove a user.
  2. It's a big security hole, because if nothing removes the previous ACLs and a new guest chose the username shigeno... BAM, it's christmass.

How can I update (and remove if I delete a user) ACL security identity?

Note: I've seen this similar subject. It didn't answer the update question, moreover, doing a raw SQL request in this context is highly insecure (and yeah, it's ugly too).

  • 写回答

1条回答 默认 最新

  • dongyulan6251 2015-01-13 17:14
    关注

    Follow this Link:

    https://github.com/symfony/symfony/commit/8d39213f4cca19466f84a5656a199eee98602ab1

    You have to write a Listner, that updates the acl on preUpdate event. This was described the the commit above.

    Greetzzz :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 Keil uVision5创建project没反应
  • ¥15 mmseqs内存报错
  • ¥15 vika文档如何与obsidian同步
  • ¥15 华为手机相册里面的照片能够替换成自己想要的照片吗?
  • ¥15 陆空双模式无人机飞控设置
  • ¥15 sentaurus lithography
  • ¥100 求抖音ck号 或者提ck教程
  • ¥15 关于#linux#的问题:子进程1等待子进程A、B退出后退出(语言-c语言)
  • ¥20 web页面如何打开Outlook 365的全球离线通讯簿功能
  • ¥15 io.jsonwebtoken.security.Keys