has_roles should be is_granted in upgrade files

This commit is contained in:
Lynn 2019-11-25 15:00:05 +01:00
parent ec781c927a
commit 78ff806b77
2 changed files with 3 additions and 2 deletions

View File

@ -230,7 +230,7 @@ Security
**After**
```php
if ($this->authorizationChecker->isGranted(new Expression("has_role('ROLE_USER') or has_role('ROLE_ADMIN')"))) {}
if ($this->authorizationChecker->isGranted(new Expression("is_granted('ROLE_USER') or is_granted('ROLE_ADMIN')"))) {}
// or:
if ($this->authorizationChecker->isGranted('ROLE_USER')

View File

@ -410,7 +410,7 @@ Security
**After**
```php
if ($this->authorizationChecker->isGranted(new Expression("has_role('ROLE_USER') or has_role('ROLE_ADMIN')"))) {}
if ($this->authorizationChecker->isGranted(new Expression("is_granted('ROLE_USER') or is_granted('ROLE_ADMIN')"))) {}
// or:
if ($this->authorizationChecker->isGranted('ROLE_USER')
@ -473,6 +473,7 @@ Security
* Classes implementing the `TokenInterface` must implement the two new methods
`__serialize` and `__unserialize`
* Implementations of `Guard\AuthenticatorInterface::checkCredentials()` must return a boolean value now. Please explicitly return `false` to indicate invalid credentials.
* Removed the `has_role()` function from security expressions, use `is_granted()` instead.
SecurityBundle
--------------