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


PHP UserSecurityIdentity::getUsername方法代码示例

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


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

示例1: addObjectOwner

 /**
  * {@inheritdoc}
  */
 public function addObjectOwner(AclInterface $acl, UserSecurityIdentity $securityIdentity = null)
 {
     if (false === $this->findClassAceIndexByUsername($acl, $securityIdentity->getUsername())) {
         // only add if not already exists
         $acl->insertObjectAce($securityIdentity, constant("{$this->maskBuilderClass}::MASK_OWNER"));
     }
 }
开发者ID:clavier-souris,项目名称:SonataAdminBundle,代码行数:10,代码来源:AclSecurityHandler.php

示例2: testConstructor

 public function testConstructor()
 {
     $id = new UserSecurityIdentity('foo', 'Foo');
     $this->assertEquals('foo', $id->getUsername());
     $this->assertEquals('Foo', $id->getClass());
 }
开发者ID:richardmiller,项目名称:symfony,代码行数:6,代码来源:UserSecurityIdentityTest.php

示例3: getUpdateUserSecurityIdentitySql

 /**
  * Constructs the SQL for updating a user security identity.
  *
  * @param UserSecurityIdentity $usid
  * @param string $oldUsername
  * @return string
  */
 protected function getUpdateUserSecurityIdentitySql(UserSecurityIdentity $usid, $oldUsername)
 {
     if ($usid->getUsername() == $oldUsername) {
         throw new \InvalidArgumentException('There are no changes.');
     }
     $oldIdentifier = $usid->getClass() . '-' . $oldUsername;
     $newIdentifier = $usid->getClass() . '-' . $usid->getUsername();
     return sprintf('UPDATE %s SET identifier = %s WHERE identifier = %s AND username = %s', $this->options['sid_table_name'], $this->connection->quote($newIdentifier), $this->connection->quote($oldIdentifier), $this->connection->getDatabasePlatform()->convertBooleans(true));
 }
开发者ID:rcastardo,项目名称:symfony,代码行数:16,代码来源:MutableAclProvider.php

示例4: testConstructorWithProxy

 public function testConstructorWithProxy()
 {
     $id = new UserSecurityIdentity('foo', 'Acme\\DemoBundle\\Proxy\\__CG__\\Symfony\\Component\\Security\\Tests\\Acl\\Domain\\Foo');
     $this->assertEquals('foo', $id->getUsername());
     $this->assertEquals('Acme\\DemoBundle\\Proxy\\__CG__\\Symfony\\Component\\Security\\Tests\\Acl\\Domain\\Foo', $id->getClass());
 }
开发者ID:d3ancole1995,项目名称:symfony,代码行数:6,代码来源:UserSecurityIdentityTest.php


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