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


PHP AclInterface::getObjectIdentity方法代码示例

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


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

示例1: putInCache

 /**
  * {@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);
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:16,代码来源:AclCache.php

示例2: isAceApplicable

 /**
  * Determines whether the ACE is applicable to the given permission/security identity combination.
  *
  * Strategy ALL:
  *     The ACE will be considered applicable when all the turned-on bits in the
  *     required mask are also turned-on in the ACE mask.
  *
  * Strategy ANY:
  *     The ACE will be considered applicable when any of the turned-on bits in
  *     the required mask is also turned-on the in the ACE mask.
  *
  * Strategy EQUAL:
  *     The ACE will be considered applicable when the bitmasks are equal.
  *
  * @param integer $requiredMask
  * @param EntryInterface $ace
  * @param AclInterface $acl
  * @throws \RuntimeException if the ACE strategy is not supported
  * @return bool
  */
 protected function isAceApplicable($requiredMask, EntryInterface $ace, AclInterface $acl)
 {
     $extension = $this->getContext()->getAclExtension();
     $aceMask = $ace->getMask();
     if ($acl->getObjectIdentity()->getType() === ObjectIdentityFactory::ROOT_IDENTITY_TYPE) {
         if ($acl->getObjectIdentity()->getIdentifier() !== $extension->getExtensionKey()) {
             return false;
         }
         $aceMask = $extension->adaptRootMask($aceMask, $this->getContext()->getObject());
     }
     if ($extension->getServiceBits($requiredMask) !== $extension->getServiceBits($aceMask)) {
         return false;
     }
     $requiredMask = $extension->removeServiceBits($requiredMask);
     $aceMask = $extension->removeServiceBits($aceMask);
     $strategy = $ace->getStrategy();
     switch ($strategy) {
         case self::ALL:
             return $requiredMask === ($aceMask & $requiredMask);
         case self::ANY:
             return 0 !== ($aceMask & $requiredMask);
         case self::EQUAL:
             return $requiredMask === $aceMask;
         default:
             throw new \RuntimeException(sprintf('The strategy "%s" is not supported.', $strategy));
     }
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:47,代码来源:PermissionGrantingStrategy.php


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