本文整理匯總了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());
}