예제 #1
0
 public function putInCache(AclInterface $acl)
 {
     if (null === $acl->getId()) {
         throw new \InvalidArgumentException('The given ACL does not have an ID.');
     }
     $this->content[$acl->getId()] = $acl;
 }
예제 #2
0
파일: AclCache.php 프로젝트: Dren-x/mobit
 /**
  * {@inheritdoc}
  */
 public function putInCache(AclInterface $acl)
 {
     if (null === $acl->getId()) {
         throw new \InvalidArgumentException('Transient ACLs cannot be cached.');
     }
     $parentAcl = $acl->getParentAcl();
     if (null !== $parentAcl) {
         $this->putInCache($parentAcl);
     }
     $key = $this->createKeyFromIdentity($acl->getObjectIdentity());
     $this->cache->save($key, serialize($acl));
     $this->cache->save($acl->getId(), $key);
 }
예제 #3
0
파일: Acl.php 프로젝트: tsurune/Pruebas
 /**
  * {@inheritdoc}
  */
 public function setParentAcl(AclInterface $acl = null)
 {
     if (null !== $acl && null === $acl->getId()) {
         throw new \InvalidArgumentException('$acl must have an ID.');
     }
     if ($this->parentAcl !== $acl) {
         $this->onPropertyChanged('parentAcl', $this->parentAcl, $acl);
         $this->parentAcl = $acl;
     }
 }
예제 #4
0
 /**
  * This regenerates the ancestor table which is used for fast read access.
  *
  * @param AclInterface $acl
  */
 private function regenerateAncestorRelations(AclInterface $acl)
 {
     $pk = $acl->getId();
     $this->connection->executeQuery($this->getDeleteObjectIdentityRelationsSql($pk));
     $this->connection->executeQuery($this->getInsertObjectIdentityRelationSql($pk, $pk));
     $parentAcl = $acl->getParentAcl();
     while (null !== $parentAcl) {
         $this->connection->executeQuery($this->getInsertObjectIdentityRelationSql($pk, $parentAcl->getId()));
         $parentAcl = $parentAcl->getParentAcl();
     }
 }
 /**
  * This updates the parent and ancestors in the identity
  *
  * @param AclInterface $acl
  * @param array $changes
  * @return void
  */
 protected function updateObjectIdentity(AclInterface $acl, array $changes)
 {
     if (isset($changes['entriesInheriting'])) {
         $updates['entriesInheriting'] = $changes['entriesInheriting'][1];
     }
     if (isset($changes['parentAcl'])) {
         $query = array('_id' => new \MongoId($acl->getParentAcl()->getId()));
         $parent = $this->connection->selectCollection($this->options['oid_collection'])->findOne($query);
         $updates['parent'] = $parent;
         if (isset($parent['ancestors'])) {
             $ancestors = $parent['ancestors'];
         }
         $ancestors[] = $parent['_id'];
         $updates['ancestors'] = $ancestors;
     }
     if (!isset($updates)) {
         return;
     }
     $entry = array('_id' => new \MongoId($acl->getId()));
     $newData = array('$set' => $updates);
     $this->connection->selectCollection($this->options['oid_collection'])->update($entry, $newData);
 }