當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。