/** * {@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")); } }
public function testConstructor() { $id = new UserSecurityIdentity('foo', 'Foo'); $this->assertEquals('foo', $id->getUsername()); $this->assertEquals('Foo', $id->getClass()); }
/** * 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)); }
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()); }