Fixed kekrozsak:security:init some more

Signed-off-by: Gergely Polonkai <polesz@w00d5t0ck.info>
This commit is contained in:
Polonkai Gergely 2012-08-30 21:52:53 +02:00
parent 29a72c1605
commit 6a0bb96c5a

View File

@ -49,19 +49,19 @@ EOF
$aclProvider = $container->get('security.acl.provider'); $aclProvider = $container->get('security.acl.provider');
$classNames = array( $classNames = array(
'KekRozsak\\FrontBundle\\Entity\\News', 'newsClass' => 'KekRozsak\\FrontBundle\\Entity\\News',
'KekRozsak\\FrontBundle\\Entity\\Articles', 'articlesClass' => 'KekRozsak\\FrontBundle\\Entity\\Articles',
); );
$securityIdentity = new RoleSecurityIdentity('ROLE_ADMIN'); $securityIdentity = new RoleSecurityIdentity('ROLE_ADMIN');
foreach ($classNames as $className) { foreach ($classNames as $id => $className) {
$objectIdentity = new ObjectIdentity('class', $className); $objectIdentity = new ObjectIdentity($id, $className);
try { try {
$acl = $aclProvider->findAcl($objectIdentity, array($securityIdentity)); $acl = $aclProvider->findAcl($objectIdentity, array($securityIdentity));
} catch (AclNotFoundException $e) { } catch (AclNotFoundException $e) {
$acl = $aclProvider->createAcl($objectIdentity); $acl = $aclProvider->createAcl($objectIdentity);
} }
$acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_OWNER); $acl->insertClassAce($securityIdentity, MaskBuilder::MASK_OWNER);
$aclProvider->updateAcl($acl); $aclProvider->updateAcl($acl);
} }
} }