| 1 | <?php |
||
| 5 | class YamlAclFixture extends AbstractFixture |
||
| 6 | { |
||
| 7 | public function load($acl_manager, $tags = null) |
||
| 8 | { |
||
| 9 | if (!$this->hasTag($tags) || !isset($this->file['acl'])) { |
||
| 10 | return; |
||
| 11 | } |
||
| 12 | |||
| 13 | foreach ($this->file['acl'] as $reference => $permissions) { |
||
| 14 | foreach ($permissions as $user => $permission) { |
||
| 15 | $acl_manager->setObjectPermission( |
||
| 16 | $this->loader->getReference($reference), |
||
| 17 | $this->getMask($permission), |
||
| 18 | $this->loader->getReference($user) |
||
| 19 | ); |
||
| 20 | } |
||
| 21 | } |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Retrieves the constant value for the given mask name |
||
| 26 | * @param type $permission |
||
| 27 | * @return type |
||
| 28 | */ |
||
| 29 | public function getMask($permission) |
||
| 30 | { |
||
| 31 | return constant('Symfony\Component\Security\Acl\Permission\MaskBuilder::'.$permission); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function createObject($class, $data, $metadata, $options = array()) |
||
| 38 | } |
||
| 39 |