diff options
-rw-r--r-- | Acl/Dbal/AclProvider.php | 2 | ||||
-rw-r--r-- | Acl/Dbal/MutableAclProvider.php | 4 | ||||
-rw-r--r-- | Acl/Domain/AuditLogger.php | 2 | ||||
-rw-r--r-- | Acl/Domain/ObjectIdentity.php | 2 | ||||
-rw-r--r-- | Acl/Domain/PermissionGrantingStrategy.php | 4 | ||||
-rw-r--r-- | Acl/Domain/SecurityIdentityRetrievalStrategy.php | 4 | ||||
-rw-r--r-- | Acl/Permission/MaskBuilder.php | 4 | ||||
-rw-r--r-- | Acl/Voter/AclVoter.php | 6 | ||||
-rw-r--r-- | Core/Authentication/Token/AbstractToken.php | 6 | ||||
-rw-r--r-- | Http/Firewall/AbstractAuthenticationListener.php | 2 | ||||
-rw-r--r-- | README.md | 18 |
11 files changed, 36 insertions, 18 deletions
diff --git a/Acl/Dbal/AclProvider.php b/Acl/Dbal/AclProvider.php index e57929e..8413843 100644 --- a/Acl/Dbal/AclProvider.php +++ b/Acl/Dbal/AclProvider.php @@ -494,7 +494,7 @@ QUERY; $acl = $acls[$aclId]; // has the ACL been hydrated during any previous cycle, or was possibly loaded // from cache? - } else if (isset($loadedAcls[$classType][$objectIdentifier])) { + } elseif (isset($loadedAcls[$classType][$objectIdentifier])) { $acl = $loadedAcls[$classType][$objectIdentifier]; // keep reference in local array (saves us some hash calculations) diff --git a/Acl/Dbal/MutableAclProvider.php b/Acl/Dbal/MutableAclProvider.php index f1c5e08..3ae08d3 100644 --- a/Acl/Dbal/MutableAclProvider.php +++ b/Acl/Dbal/MutableAclProvider.php @@ -511,7 +511,7 @@ QUERY; if ($sid instanceof UserSecurityIdentity) { $identifier = $sid->getClass().'-'.$sid->getUsername(); $username = true; - } else if ($sid instanceof RoleSecurityIdentity) { + } elseif ($sid instanceof RoleSecurityIdentity) { $identifier = $sid->getRole(); $username = false; } else { @@ -579,7 +579,7 @@ QUERY; if ($sid instanceof UserSecurityIdentity) { $identifier = $sid->getClass().'-'.$sid->getUsername(); $username = true; - } else if ($sid instanceof RoleSecurityIdentity) { + } elseif ($sid instanceof RoleSecurityIdentity) { $identifier = $sid->getRole(); $username = false; } else { diff --git a/Acl/Domain/AuditLogger.php b/Acl/Domain/AuditLogger.php index fa91b60..8174873 100644 --- a/Acl/Domain/AuditLogger.php +++ b/Acl/Domain/AuditLogger.php @@ -36,7 +36,7 @@ abstract class AuditLogger implements AuditLoggerInterface if ($granted && $ace->isAuditSuccess()) { $this->doLog($granted, $ace); - } else if (!$granted && $ace->isAuditFailure()) { + } elseif (!$granted && $ace->isAuditFailure()) { $this->doLog($granted, $ace); } } diff --git a/Acl/Domain/ObjectIdentity.php b/Acl/Domain/ObjectIdentity.php index ee2fafc..2bd152a 100644 --- a/Acl/Domain/ObjectIdentity.php +++ b/Acl/Domain/ObjectIdentity.php @@ -60,7 +60,7 @@ final class ObjectIdentity implements ObjectIdentityInterface try { if ($domainObject instanceof DomainObjectInterface) { return new self($domainObject->getObjectIdentifier(), get_class($domainObject)); - } else if (method_exists($domainObject, 'getId')) { + } elseif (method_exists($domainObject, 'getId')) { return new self($domainObject->getId(), get_class($domainObject)); } } catch (\InvalidArgumentException $invalid) { diff --git a/Acl/Domain/PermissionGrantingStrategy.php b/Acl/Domain/PermissionGrantingStrategy.php index 152b704..c34db2a 100644 --- a/Acl/Domain/PermissionGrantingStrategy.php +++ b/Acl/Domain/PermissionGrantingStrategy.php @@ -196,9 +196,9 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface $strategy = $ace->getStrategy(); if (self::ALL === $strategy) { return $requiredMask === ($ace->getMask() & $requiredMask); - } else if (self::ANY === $strategy) { + } elseif (self::ANY === $strategy) { return 0 !== ($ace->getMask() & $requiredMask); - } else if (self::EQUAL === $strategy) { + } elseif (self::EQUAL === $strategy) { return $requiredMask === $ace->getMask(); } diff --git a/Acl/Domain/SecurityIdentityRetrievalStrategy.php b/Acl/Domain/SecurityIdentityRetrievalStrategy.php index 70b6d90..dbc0530 100644 --- a/Acl/Domain/SecurityIdentityRetrievalStrategy.php +++ b/Acl/Domain/SecurityIdentityRetrievalStrategy.php @@ -67,10 +67,10 @@ class SecurityIdentityRetrievalStrategy implements SecurityIdentityRetrievalStra $sids[] = new RoleSecurityIdentity(AuthenticatedVoter::IS_AUTHENTICATED_FULLY); $sids[] = new RoleSecurityIdentity(AuthenticatedVoter::IS_AUTHENTICATED_REMEMBERED); $sids[] = new RoleSecurityIdentity(AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY); - } else if ($this->authenticationTrustResolver->isRememberMe($token)) { + } elseif ($this->authenticationTrustResolver->isRememberMe($token)) { $sids[] = new RoleSecurityIdentity(AuthenticatedVoter::IS_AUTHENTICATED_REMEMBERED); $sids[] = new RoleSecurityIdentity(AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY); - } else if ($this->authenticationTrustResolver->isAnonymous($token)) { + } elseif ($this->authenticationTrustResolver->isAnonymous($token)) { $sids[] = new RoleSecurityIdentity(AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY); } diff --git a/Acl/Permission/MaskBuilder.php b/Acl/Permission/MaskBuilder.php index e81005b..44ee274 100644 --- a/Acl/Permission/MaskBuilder.php +++ b/Acl/Permission/MaskBuilder.php @@ -93,7 +93,7 @@ class MaskBuilder { if (is_string($mask) && defined($name = 'static::MASK_'.strtoupper($mask))) { $mask = constant($name); - } else if (!is_int($mask)) { + } elseif (!is_int($mask)) { throw new \InvalidArgumentException('$mask must be an integer.'); } @@ -146,7 +146,7 @@ class MaskBuilder { if (is_string($mask) && defined($name = 'static::MASK_'.strtoupper($mask))) { $mask = constant($name); - } else if (!is_int($mask)) { + } elseif (!is_int($mask)) { throw new \InvalidArgumentException('$mask must be an integer.'); } diff --git a/Acl/Voter/AclVoter.php b/Acl/Voter/AclVoter.php index d9e8c03..456c434 100644 --- a/Acl/Voter/AclVoter.php +++ b/Acl/Voter/AclVoter.php @@ -64,7 +64,7 @@ class AclVoter implements VoterInterface } return $this->allowIfObjectIdentityUnavailable ? self::ACCESS_GRANTED : self::ACCESS_ABSTAIN; - } else if ($object instanceof FieldVote) { + } elseif ($object instanceof FieldVote) { $field = $object->getField(); $object = $object->getDomainObject(); } else { @@ -73,7 +73,7 @@ class AclVoter implements VoterInterface if ($object instanceof ObjectIdentityInterface) { $oid = $object; - } else if (null === $oid = $this->objectIdentityRetrievalStrategy->getObjectIdentity($object)) { + } elseif (null === $oid = $this->objectIdentityRetrievalStrategy->getObjectIdentity($object)) { if (null !== $this->logger) { $this->logger->debug(sprintf('Object identity unavailable. Voting to %s', $this->allowIfObjectIdentityUnavailable? 'grant access' : 'abstain')); } @@ -96,7 +96,7 @@ class AclVoter implements VoterInterface } return self::ACCESS_GRANTED; - } else if (null !== $field && $acl->isFieldGranted($field, $masks, $sids, false)) { + } elseif (null !== $field && $acl->isFieldGranted($field, $masks, $sids, false)) { if (null !== $this->logger) { $this->logger->debug('ACL found, permission granted. Voting to grant access'); } diff --git a/Core/Authentication/Token/AbstractToken.php b/Core/Authentication/Token/AbstractToken.php index ee6b207..dc21684 100644 --- a/Core/Authentication/Token/AbstractToken.php +++ b/Core/Authentication/Token/AbstractToken.php @@ -42,7 +42,7 @@ abstract class AbstractToken implements TokenInterface foreach ($roles as $role) { if (is_string($role)) { $role = new Role($role); - } else if (!$role instanceof RoleInterface) { + } elseif (!$role instanceof RoleInterface) { throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, or RoleInterface instances, but got %s.', gettype($role))); } @@ -83,13 +83,13 @@ abstract class AbstractToken implements TokenInterface if (null === $this->user) { $changed = false; - } else if ($this->user instanceof UserInterface) { + } elseif ($this->user instanceof UserInterface) { if (!$user instanceof UserInterface) { $changed = true; } else { $changed = !$this->user->equals($user); } - } else if ($user instanceof UserInterface) { + } elseif ($user instanceof UserInterface) { $changed = true; } else { $changed = (string) $this->user !== (string) $user; diff --git a/Http/Firewall/AbstractAuthenticationListener.php b/Http/Firewall/AbstractAuthenticationListener.php index 9f91a39..99f92b8 100644 --- a/Http/Firewall/AbstractAuthenticationListener.php +++ b/Http/Firewall/AbstractAuthenticationListener.php @@ -144,7 +144,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface $this->sessionStrategy->onAuthentication($request, $returnValue); $response = $this->onSuccess($event, $request, $returnValue); - } else if ($returnValue instanceof Response) { + } elseif ($returnValue instanceof Response) { $response = $returnValue; } else { throw new \RuntimeException('attemptAuthentication() must either return a Response, an implementation of TokenInterface, or null.'); diff --git a/README.md b/README.md new file mode 100644 index 0000000..7aea890 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +Security Component +================== + +Security provides an infrastructure for sophisticated authorization systems, +which makes it possible to easily separate the actual authorization logic from +so called user providers that hold the users credentials. It is inspired by +the Java Spring framework. + +Resources +--------- + +Unit tests: + +https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/Security + +Documentation: + +http://symfony.com/doc/2.0/book/security.html |