Esempio n. 1
0
File: Acl.php Progetto: alexdpy/acl
 /**
  * @param DatabaseProviderInterface $databaseProvider
  * @param PermissionBufferInterface $permissionBuffer
  * @param string                    $maskBuilderClass
  * @param AclSchema                 $aclSchema
  *
  * @throws InvalidMaskBuilderException
  */
 public function __construct(DatabaseProviderInterface $databaseProvider, PermissionBufferInterface $permissionBuffer, $maskBuilderClass = 'AlexDpy\\Acl\\Mask\\BasicMaskBuilder', AclSchema $aclSchema = null)
 {
     if (!class_exists($maskBuilderClass)) {
         throw new InvalidMaskBuilderException(sprintf('Class "%s" does not exist', $maskBuilderClass));
     }
     $this->maskBuilderClass = $maskBuilderClass;
     if (!$this->getMaskBuilder() instanceof MaskBuilderInterface) {
         throw new InvalidMaskBuilderException(sprintf('Class "%s" must implements MaskBuilderInterface', $maskBuilderClass));
     }
     if (null === $aclSchema) {
         $aclSchema = new AclSchema();
     }
     $databaseProvider->setAclSchema($aclSchema);
     $this->databaseProvider = $databaseProvider;
     $this->permissionBuffer = $permissionBuffer;
     $this->aclSchema = $aclSchema;
 }
 protected function setUp()
 {
     parent::setUp();
     $this->databaseProvider = $this->getDatabaseProvider();
     $this->databaseProvider->setAclSchema($this->aclSchema);
 }