1
ACLについての詳細は不足しています。これは、ドメインオブジェクトを永続化した後にcreateAcl
を呼び出すのと同じくらい簡単です。次に、ユーザ/オブジェクトにinsertObjectAce
というマスクを付けます。Symfony2はどのようにACLを内部的に管理していますか?
しかし、内部的にSymfony2がACLを管理していますか?余分な列がテーブルに追加されていますか?
$entityManager = $this->get('doctrine.orm.default_entity_manager');
$entityManager->persist($comment);
$entityManager->flush();
// creating the ACL
$aclProvider = $this->get('security.acl.provider');
$objectIdentity = ObjectIdentity::fromDomainObject($comment);
$acl = $aclProvider->createAcl($objectIdentity);
// retrieving the security identity of the currently logged-in user
$securityContext = $this->get('security.context');
$user = $securityContext->getToken()->getUser();
$securityIdentity = UserSecurityIdentity::fromAccount($user);
// grant owner access
$acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_OWNER);
$aclProvider->updateAcl($acl);