当前位置: 首页>>代码示例>>PHP>>正文


PHP Model\ObjectIdentityInterface类代码示例

本文整理汇总了PHP中Symfony\Component\Security\Acl\Model\ObjectIdentityInterface的典型用法代码示例。如果您正苦于以下问题:PHP ObjectIdentityInterface类的具体用法?PHP ObjectIdentityInterface怎么用?PHP ObjectIdentityInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ObjectIdentityInterface类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: underlying

 /**
  * Constructs an underlying ObjectIdentity for given ObjectIdentity
  * Underlying is class level ObjectIdentity for given object level ObjectIdentity.
  *
  * @param ObjectIdentityInterface $oid
  * @return ObjectIdentity
  * @throws InvalidAclException
  */
 public function underlying(ObjectIdentityInterface $oid)
 {
     if ($oid->getIdentifier() === self::ROOT_IDENTITY_TYPE || $oid->getIdentifier() === ($extensionKey = $this->extensionSelector->select($oid)->getExtensionKey())) {
         throw new InvalidAclException(sprintf('Cannot get underlying ACL for %s', $oid));
     }
     return new ObjectIdentity($extensionKey, $oid->getType());
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:ObjectIdentityFactory.php

示例2: fromAclObjectIdentity

 /**
  * Return an AclClass for the given ACL ObjectIdentity.
  *
  * If none can be found, a new one will be saved.
  *
  * @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
  * @param \PropelPDO $con
  *
  * @return \Propel\PropelBundle\Model\Acl\AclClass
  */
 public static function fromAclObjectIdentity(ObjectIdentityInterface $objectIdentity, \PropelPDO $con = null)
 {
     $obj = AclClassQuery::create()->filterByType($objectIdentity->getType())->findOneOrCreate($con);
     if ($obj->isNew()) {
         $obj->save($con);
     }
     return $obj;
 }
开发者ID:angelk,项目名称:PropelBundle,代码行数:18,代码来源:AclClass.php

示例3: findByAclIdentity

 /**
  * Return Entry objects filtered by an ACL related ObjectIdentity.
  *
  * @see find()
  *
  * @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity     An ACL related ObjectIdentity.
  * @param array                                                         $securityIdentities A list of SecurityIdentity to filter by.
  * @param \PropelPDO                                                    $con
  *
  * @return \PropelObjectCollection
  */
 public function findByAclIdentity(ObjectIdentityInterface $objectIdentity, array $securityIdentities = array(), \PropelPDO $con = null)
 {
     $securityIds = array();
     foreach ($securityIdentities as $eachIdentity) {
         if (!$eachIdentity instanceof SecurityIdentityInterface) {
             if (is_object($eachIdentity)) {
                 $errorMessage = sprintf('The list of security identities contains at least one invalid entry of class "%s". Please provide objects of classes implementing "Symfony\\Component\\Security\\Acl\\Model\\SecurityIdentityInterface" only.', get_class($eachIdentity));
             } else {
                 $errorMessage = sprintf('The list of security identities contains at least one invalid entry "%s". Please provide objects of classes implementing "Symfony\\Component\\Security\\Acl\\Model\\SecurityIdentityInterface" only.', $eachIdentity);
             }
             throw new \InvalidArgumentException($errorMessage);
         }
         if ($securityIdentity = SecurityIdentity::fromAclIdentity($eachIdentity)) {
             $securityIds[$securityIdentity->getId()] = $securityIdentity->getId();
         }
     }
     $this->useAclClassQuery(null, \Criteria::INNER_JOIN)->filterByType((string) $objectIdentity->getType())->endUse()->leftJoinObjectIdentity()->add(ObjectIdentityPeer::OBJECT_IDENTIFIER, (string) $objectIdentity->getIdentifier(), \Criteria::EQUAL)->addOr(EntryPeer::OBJECT_IDENTITY_ID, null, \Criteria::ISNULL);
     if (!empty($securityIdentities)) {
         $this->filterBySecurityIdentityId($securityIds);
     }
     return $this->find($con);
 }
开发者ID:propelorm,项目名称:PropelAclBundle,代码行数:33,代码来源:EntryQuery.php

示例4: createKeyFromIdentity

 /**
  * Returns the key for the object identity
  *
  * @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $oid
  *
  * @return string
  */
 private function createKeyFromIdentity(ObjectIdentityInterface $oid)
 {
     return $oid->getType() . '_' . $oid->getIdentifier();
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:11,代码来源:AclCache.php

示例5: getSelectObjectIdentityIdSql

    /**
     * Constructs the SQL for retrieving the primary key of the given object
     * identity.
     *
     * @param ObjectIdentityInterface $oid
     * @return string
     */
    protected function getSelectObjectIdentityIdSql(ObjectIdentityInterface $oid)
    {
        $query = <<<QUERY
            SELECT o.id
            FROM %s o
            INNER JOIN %s c ON c.id = o.class_id
            WHERE o.object_identifier = %s AND c.class_type = %s
            LIMIT 1
QUERY;
        return sprintf($query, $this->options['oid_table_name'], $this->options['class_table_name'], $this->connection->quote($oid->getIdentifier()), $this->connection->quote($oid->getType()));
    }
开发者ID:notbrain,项目名称:symfony,代码行数:18,代码来源:AclProvider.php

示例6: getDataKeyByIdentity

 /**
  * Returns the key for the object identity
  *
  * @param ObjectIdentityInterface $oid
  * @return string
  */
 private function getDataKeyByIdentity(ObjectIdentityInterface $oid)
 {
     return $this->prefix . md5($oid->getType()) . sha1($oid->getType()) . '_' . md5($oid->getIdentifier()) . sha1($oid->getIdentifier());
 }
开发者ID:iurkidi,项目名称:nmarcajunto,代码行数:10,代码来源:DoctrineAclCache.php

示例7: createObjectIdentity

 /**
  * Creates the ACL for the passed object identity
  *
  * @param ObjectIdentityInterface $oid
  */
 private function createObjectIdentity(ObjectIdentityInterface $oid)
 {
     $classId = $this->createOrRetrieveClassId($oid->getType());
     $this->connection->executeQuery($this->getInsertObjectIdentitySql($oid->getIdentifier(), $classId, true));
 }
开发者ID:rcastardo,项目名称:symfony,代码行数:10,代码来源:MutableAclProvider.php

示例8: retrieveObjectIdentityPrimaryKey

 /**
  * Returns the primary key of the passed object identity.
  *
  * @param ObjectIdentityInterface $oid
  * @return integer
  */
 protected function retrieveObjectIdentityPrimaryKey(ObjectIdentityInterface $oid)
 {
     $query = array("identifier" => $oid->getIdentifier(), "type" => $oid->getType());
     $fields = array("_id" => true);
     $id = $this->connection->selectCollection($this->options['oid_collection'])->findOne($query, $fields);
     return $id ? array_pop($id) : null;
 }
开发者ID:netvlies,项目名称:MongoDBAclBundle,代码行数:13,代码来源:AclProvider.php

示例9: equals

 /**
  * {@inheritDoc}
  */
 public function equals(ObjectIdentityInterface $identity)
 {
     // comparing the identifier with === might lead to problems, so we
     // waive this restriction
     return $this->identifier == $identity->getIdentifier()
            && $this->type === $identity->getType();
 }
开发者ID:usefulthink,项目名称:symfony,代码行数:10,代码来源:ObjectIdentity.php

示例10: createObjectIdentity

 /**
  * Creates the ACL for the passed object identity
  *
  * @param ObjectIdentityInterface $oid
  * @param boolean $entriesInheriting
  * @param ObjectIdentityInterface $parent
  * @return void
  */
 protected function createObjectIdentity(ObjectIdentityInterface $oid, $entriesInheriting = false, ObjectIdentityInterface $parent = null)
 {
     $data['identifier'] = $oid->getIdentifier();
     $data['type'] = $oid->getType();
     $data['entriesInheriting'] = $entriesInheriting;
     if ($parent) {
         $ancestors = array();
         $parentDocument = $this->getObjectIdentity($parent);
         if (isset($parent['ancestors'])) {
             $ancestors = $parentDocument['ancestors'];
         }
         $ancestors[] = $parentDocument['_id'];
         $data['parent'] = $parentDocument;
         $data['ancestors'] = $ancestors;
     }
     // TODO: safe options
     $this->connection->selectCollection($this->options['oid_collection'])->insert($data);
 }
开发者ID:Cobrowser,项目名称:MongoDBAclBundle,代码行数:26,代码来源:MutableAclProvider.php


注:本文中的Symfony\Component\Security\Acl\Model\ObjectIdentityInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。