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


PHP SecurityIdentityInterface::equals方法代码示例

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


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

示例1: revokeMask

 /**
  * @param $entity
  * @param $mask
  * @param SecurityIdentityInterface $securityIdentity
  * @return $this
  */
 public function revokeMask($entity, $mask, SecurityIdentityInterface $securityIdentity)
 {
     $acl = $this->getAcl($entity);
     $aces = $acl->getObjectAces();
     foreach ($aces as $index => $ace) {
         if ($securityIdentity->equals($ace->getSecurityIdentity())) {
             $this->removeMask($index, $acl, $ace, $mask);
         }
     }
     $this->aclProvider->updateAcl($acl);
     return $this;
 }
开发者ID:GTheron,项目名称:RestBundle,代码行数:18,代码来源:AuthorizationManager.php

示例2: getAces

 /**
  * Gets all ACEs associated with given ACL and the given security identity
  *
  * @param SID $sid
  * @param AclInterface $acl
  * @param string $type The ACE type. Can be one of AclManager::*_ACE constants
  * @param string|null $field The name of a field.
  *                           Set to null for class-based or object-based ACE
  *                           Set to not null class-field-based or object-field-based ACE
  * @return EntryInterface[]
  */
 protected function getAces(SID $sid, AclInterface $acl, $type, $field)
 {
     return array_filter($this->manager->getAceProvider()->getAces($acl, $type, $field), function ($ace) use(&$sid) {
         /** @var EntryInterface $ace */
         return $sid->equals($ace->getSecurityIdentity());
     });
 }
开发者ID:ramunasd,项目名称:platform,代码行数:18,代码来源:AclPrivilegeRepository.php

示例3: doGetAces

 /**
  * Gets all ACEs associated with given ACL and the given security identity
  *
  * @param SID $sid
  * @param OID $oid
  * @param string $type The ACE type. Can be one of self::*_ACE constants
  * @param string|null $field The name of a field.
  *                           Set to null for class-based or object-based ACE
  *                           Set to not null class-field-based or object-field-based ACE
  * @return EntryInterface[]
  */
 protected function doGetAces(SID $sid, OID $oid, $type, $field)
 {
     $acl = $this->getAcl($oid);
     if (!$acl) {
         return array();
     }
     return array_filter($this->aceProvider->getAces($acl, $type, $field), function ($ace) use(&$sid) {
         /** @var EntryInterface $ace */
         return $sid->equals($ace->getSecurityIdentity());
     });
 }
开发者ID:Maksold,项目名称:platform,代码行数:22,代码来源:AclManager.php

示例4: deleteAllPermissions

 /**
  * Deletes all ACEs for the given security identity from the given ACL
  *
  * @param ACL $acl
  * @param string $type The ACE type. Can be one of AclManager::*_ACE constants
  * @param string|null $field The name of a field.
  *                           Set to null for class-based or object-based ACE
  *                           Set to not null class-field-based or object-field-based ACE
  * @param SID $sid
  * @return bool True if at least one permission was deleted
  */
 public function deleteAllPermissions(ACL $acl, $type, $field, SID $sid)
 {
     $hasChanges = false;
     $aces = $this->getAces($acl, $type, $field);
     foreach ($aces as $index => $ace) {
         if ($sid->equals($ace->getSecurityIdentity())) {
             $this->deleteAce($acl, $type, $field, $index);
             $hasChanges = true;
         }
     }
     return $hasChanges;
 }
开发者ID:Maksold,项目名称:platform,代码行数:23,代码来源:AceManipulationHelper.php

示例5: removeAces

 /**
  * Deletes all ACEs the given type and security identity from the list of ACEs associated with this item
  *
  * @param string      $type  The ACE type. Can be one of AclManager::*_ACE constants
  * @param string|null $field The name of a field.
  *                           Set to null for class-based or object-based ACE
  *                           Set to not null class-field-based or object-field-based ACE
  * @param SID $sid
  */
 public function removeAces($type, $field, SID $sid)
 {
     if ($this->aces !== null) {
         $toRemoveKeys = [];
         foreach ($this->aces as $key => $val) {
             if ($sid->equals($val->getSecurityIdentity()) && $type === $val->getType() && $field === $val->getField()) {
                 $toRemoveKeys[] = $key;
                 break;
             }
         }
         if (!empty($toRemoveKeys)) {
             foreach ($toRemoveKeys as $key) {
                 $this->aces->remove($key);
             }
         }
     }
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:26,代码来源:BatchItem.php

示例6: revoke

 /**
  * @param ObjectIdentityInterface   $objectIdentity
  * @param SecurityIdentityInterface $securityIdentity
  * @param string|string[]           $permissions
  * @param string                    $type
  * @param null|string               $field
  */
 protected function revoke(ObjectIdentityInterface $objectIdentity, SecurityIdentityInterface $securityIdentity, $permissions, $type, $field = null)
 {
     if (null === ($acl = $this->findAcl($objectIdentity))) {
         return;
     }
     $index = false;
     $oldMask = 0;
     /** @var Entry $ace */
     foreach ($acl->{$this->resolveAceMethod('get', $type, $field)}($field) as $k => $ace) {
         if ($securityIdentity->equals($ace->getSecurityIdentity())) {
             $index = $k;
             $oldMask = $ace->getMask();
             continue;
         }
     }
     if (false !== $index) {
         $maskBuilder = $this->permissionMap->getMaskBuilder();
         $maskBuilder->set($oldMask);
         foreach ((array) $permissions as $permission) {
             $maskBuilder->remove($permission);
         }
         if (null === $field) {
             $acl->{$this->resolveAceMethod('update', $type)}($index, $maskBuilder->get());
         } else {
             $acl->{$this->resolveAceMethod('update', $type, $field)}($index, $field, $maskBuilder->get());
         }
     }
     $this->aclProvider->updateAcl($acl);
 }
开发者ID:dragosprotung,项目名称:AclBundle,代码行数:36,代码来源:AclManager.php


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