Skip to content

[Security] Fixed typos/CS/PHPDoc #9594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Symfony/Component/Security/Acl/Dbal/AclProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ public function findAcls(array $oids, array $sids = array())
if ((self::MAX_BATCH_SIZE === count($currentBatch) || ($i + 1) === $c) && count($currentBatch) > 0) {
try {
$loadedBatch = $this->lookupObjectIdentities($currentBatch, $sids, $oidLookup);
} catch (AclNotFoundException $aclNotFoundexception) {
} catch (AclNotFoundException $aclNotFoundException) {
if ($result->count()) {
$partialResultException = new NotAllAclsFoundException('The provider could not find ACLs for all object identities.');
$partialResultException->setPartialResult($result);
throw $partialResultException;
} else {
throw $aclNotFoundexception;
throw $aclNotFoundException;
}
}
foreach ($loadedBatch as $loadedOid) {
Expand Down
14 changes: 7 additions & 7 deletions src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function updateAcl(MutableAclInterface $acl)
}

// check properties for deleted, and created ACEs, and perform deletions
// we need to perfom deletions before updating existing ACEs, in order to
// we need to perform deletions before updating existing ACEs, in order to
// preserve uniqueness of the order field
if (isset($propertyChanges['classAces'])) {
$this->updateOldAceProperty('classAces', $propertyChanges['classAces']);
Expand Down Expand Up @@ -360,7 +360,7 @@ public function updateAcl(MutableAclInterface $acl)
protected function getDeleteAccessControlEntriesSql($oidPK)
{
return sprintf(
'DELETE FROM %s WHERE object_identity_id = %d',
'DELETE FROM %s WHERE object_identity_id = %d',
$this->options['entry_table_name'],
$oidPK
);
Expand Down Expand Up @@ -806,7 +806,7 @@ private function updateNewFieldAceProperty($name, array $changes)
* @param string $name
* @param array $changes
*/
private function updateOldFieldAceProperty($ane, array $changes)
private function updateOldFieldAceProperty($name, array $changes)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow

{
$currentIds = array();
foreach ($changes[1] as $field => $new) {
Expand Down Expand Up @@ -925,11 +925,12 @@ private function updateAce(\SplObjectStorage $aces, $ace)
if (isset($propertyChanges['aceOrder'])
&& $propertyChanges['aceOrder'][1] > $propertyChanges['aceOrder'][0]
&& $propertyChanges == $aces->offsetGet($ace)) {
$aces->next();
if ($aces->valid()) {

$aces->next();
if ($aces->valid()) {
$this->updateAce($aces, $aces->current());
}
}
}

if (isset($propertyChanges['mask'])) {
$sets[] = sprintf('mask = %d', $propertyChanges['mask'][1]);
Expand All @@ -949,5 +950,4 @@ private function updateAce(\SplObjectStorage $aces, $ace)

$this->connection->executeQuery($this->getUpdateAccessControlEntrySql($ace->getId(), $sets));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public function testLogIfNeeded($granting, $audit)
->expects($this->once())
->method('isAuditSuccess')
->will($this->returnValue($audit))
;
;

$ace
$ace
->expects($this->never())
->method('isAuditFailure')
;
;
} else {
$ace
->expects($this->never())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,22 @@ public function __construct(UserProviderInterface $userProvider, UserCheckerInte
$this->providerKey = $providerKey;
}

/**
* {@inheritdoc}
*/
public function authenticate(TokenInterface $token)
{
if (!$this->supports($token)) {
return null;
}

/**
* {@inheritdoc}
*/
public function authenticate(TokenInterface $token)
{
if (!$this->supports($token)) {
return null;
}
if (!$user = $token->getUser()) {
throw new BadCredentialsException('No pre-authenticated principal found in request.');
}
/*
/*
if (null === $token->getCredentials()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this even here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure, good question

throw new BadCredentialsException('No pre-authenticated credentials found in request.');
}
*/
*/
$user = $this->userProvider->loadUserByUsername($user);

$this->userChecker->checkPostAuth($user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class ExpressionVoter implements VoterInterface
/**
* Constructor.
*
* @param ExpressionLanguage $expressionLanguage
* @param ExpressionLanguage $expressionLanguage
* @param AuthenticationTrustResolverInterface $trustResolver
* @param RoleHierarchyInterface $roleHierarchy
*/
public function __construct(ExpressionLanguage $expressionLanguage, AuthenticationTrustResolverInterface $trustResolver, RoleHierarchyInterface $roleHierarchy = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ protected function comparePasswords($password1, $password2)
/**
* Checks if the password is too long.
*
* @param string $password The password
*
* @return Boolean true if the password is too long, false otherwise
*/
protected function isPasswordTooLong($password)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testExitUserUpdatesToken()

$this->request->expects($this->any())->method('get')->with('_switch_user')->will($this->returnValue('_exit'));
$this->request->expects($this->any())->method('getUri')->will($this->returnValue('/'));
$this->request->query->expects($this->once())->method('remove','_switch_user');
$this->request->query->expects($this->once())->method('remove', '_switch_user');
$this->request->query->expects($this->any())->method('all')->will($this->returnValue(array()));
$this->request->server->expects($this->once())->method('set')->with('QUERY_STRING', '');

Expand All @@ -103,7 +103,7 @@ public function testExitUserUpdatesToken()
/**
* @expectedException \Symfony\Component\Security\Core\Exception\AccessDeniedException
*/
public function testSwitchUserIsDissallowed()
public function testSwitchUserIsDisallowed()
{
$token = $this->getToken(array($this->getMock('Symfony\Component\Security\Core\Role\RoleInterface')));

Expand All @@ -126,7 +126,7 @@ public function testSwitchUser()

$this->securityContext->expects($this->any())->method('getToken')->will($this->returnValue($token));
$this->request->expects($this->any())->method('get')->with('_switch_user')->will($this->returnValue('kuba'));
$this->request->query->expects($this->once())->method('remove','_switch_user');
$this->request->query->expects($this->once())->method('remove', '_switch_user');
$this->request->query->expects($this->any())->method('all')->will($this->returnValue(array()));

$this->request->expects($this->any())->method('getUri')->will($this->returnValue('/'));
Expand Down Expand Up @@ -156,7 +156,7 @@ public function testSwitchUserKeepsOtherQueryStringParameters()

$this->securityContext->expects($this->any())->method('getToken')->will($this->returnValue($token));
$this->request->expects($this->any())->method('get')->with('_switch_user')->will($this->returnValue('kuba'));
$this->request->query->expects($this->once())->method('remove','_switch_user');
$this->request->query->expects($this->once())->method('remove', '_switch_user');
$this->request->query->expects($this->any())->method('all')->will($this->returnValue(array('page'=>3,'section'=>2)));
$this->request->expects($this->any())->method('getUri')->will($this->returnValue('/'));
$this->request->server->expects($this->once())->method('set')->with('QUERY_STRING', 'page=3&section=2');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function dataProviderGetPreAuthenticatedData()
}

/**
* @expectedException Symfony\Component\Security\Core\Exception\BadCredentialsException
* @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException
*/
public function testGetPreAuthenticatedDataNoUser()
{
Expand Down