本文整理汇总了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"));
}
}
示例2: testConstructor
public function testConstructor()
{
$id = new UserSecurityIdentity('foo', 'Foo');
$this->assertEquals('foo', $id->getUsername());
$this->assertEquals('Foo', $id->getClass());
}
示例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));
}
示例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());
}