10000 [Security] Changed has_role to is_granted for expression in upgrade 4.4 by linaori · Pull Request #34593 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] Changed has_role to is_granted for expression in upgrade 4.4 #34593

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, 2019
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
2 changes: 1 addition & 1 deletion UPGRADE-4.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
3 changes: 2 additions & 1 deletion UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
--------------
Expand Down
0