8000 use is_granted() instead of deprecated has_role() by OskarStark · Pull Request #9919 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

use is_granted() instead of deprecated has_role() #9919

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
Jun 19, 2018

Conversation

OskarStark
Copy link
Contributor

using has_role() was deprecated in symfony/symfony#27305 since 4.2 by @nicolas-grekas

@javiereguiluz
Copy link
Member

@OskarStark thanks for updating this! I found other occurrences. Could you please change them in this PR too?

  • security.rst line 895: @Security("has_role('ROLE_ADMIN')")
  • best_practices/security.rst line 124: @Security("has_role('ROLE_ADMIN')")

Thanks!

@OskarStark
Copy link
Contributor Author

sure thing 👍

@@ -61,7 +61,7 @@ Additionally, you have access to a number of functions inside the expression:
Similar, but not equal to ``IS_AUTHENTICATED_REMEMBERED``, see below.
``is_fully_authenticated``
Similar, but not equal to ``IS_AUTHENTICATED_FULLY``, see below.
``has_role``
``is_granted``
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@javiereguiluz I found another one here, not sure if the description is still ok for is_granted instead of has_role

Copy link
Member

Choose a reason for hiding this comment

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

I agree. Here is a quick proposal:

Checks if the user has the given permission. Optionally accepts a second argument
with the object where permission is checked on. It's equivalent to using
the :doc:`isGranted() method </security/securing_services>` from the authorization
checker service.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@javiereguiluz
Copy link
Member

Thank you Oskar.

@javiereguiluz javiereguiluz merged commit 5e6031b into symfony:master Jun 19, 2018
javiereguiluz added a commit that referenced this pull request Jun 19, 2018
…tark)

This PR was merged into the master branch.

Discussion
----------

use is_granted() instead of deprecated has_role()

using `has_role()` was deprecated in symfony/symfony#27305 since `4.2` by @nicolas-grekas

Commits
-------

5e6031b use is_granted() instead of deprecated has_role()
@OskarStark OskarStark deleted the patch-15 branch June 19, 2018 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0