Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Security] Add tip for using new isGrantedForUser() function #18033

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
Jan 3, 2025

Conversation

natewiebe13
Copy link
Contributor

@natewiebe13 natewiebe13 commented Mar 9, 2023

Adds tip for using new isGrantedForUser() function from symfony/symfony#48142

@carsonbot carsonbot added this to the 6.3 milestone Mar 9, 2023
@javiereguiluz javiereguiluz added the Waiting Code Merge Docs for features pending to be merged label Mar 15, 2023
@carsonbot carsonbot modified the milestones: 6.3, next Mar 15, 2023
Copy link
Contributor

@94noni 94noni left a comment

Choose a reason for hiding this comment

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

Nice one 👍🏻

security.rst Outdated Show resolved Hide resolved
security.rst Outdated Show resolved Hide resolved
security.rst Outdated Show resolved Hide resolved
security.rst Outdated Show resolved Hide resolved
security.rst Show resolved Hide resolved
@natewiebe13 natewiebe13 requested a review from xabbuh as a code owner June 22, 2023 20:42
@natewiebe13 natewiebe13 changed the base branch from 6.3 to 6.4 June 22, 2023 20:42
security.rst Outdated
.. versionadded:: 6.4

The :method:`Symfony\\Bundle\\SecurityBundle\\Security::userIsGranted`
method was introduced in Symfony 6.4.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will need to update the two v6.4 references to the relevant release once symfony/symfony#48142 is merged.

Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps add as well a code block example :)

derrabus added a commit to symfony/symfony that referenced this pull request Dec 7, 2024
…(natewiebe13)

This PR was merged into the 7.3 branch.

Discussion
----------

[Security][SecurityBundle] User authorization checker

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #43372
| License       | MIT
| Doc PR        | symfony/symfony-docs#18033

`isGranted()` assumes that it's checking against the currently logged in user. This provides the same functionality to check against a user during times when there isn't a session (cronjobs/commands, message queue, etc.) or for a different user than the one logged in.

Having this functionality allows for removing the dependency on sessions entirely for services reducing the number of issues that come up during a project because some underlying function was session dependent.

Commits
-------

096bfaa [Security][SecurityBundle] User authorization checker
@xabbuh xabbuh modified the milestones: next, 7.3 Dec 16, 2024
@xabbuh xabbuh added Security and removed Waiting Code Merge Docs for features pending to be merged labels Dec 16, 2024
@carsonbot carsonbot changed the title Add tip for using new userIsGranted() function [Security] Add tip for using new userIsGranted() function Dec 16, 2024
security.rst Outdated Show resolved Hide resolved
@natewiebe13 natewiebe13 changed the base branch from 6.4 to 7.3 December 17, 2024 14:11
@natewiebe13 natewiebe13 changed the title [Security] Add tip for using new userIsGranted() function [Security] Add tip for using new isGrantedForUser() function Dec 17, 2024
@javiereguiluz javiereguiluz merged commit 2fda262 into symfony:7.3 Jan 3, 2025
3 checks passed
@javiereguiluz
Copy link
Member

Thanks Nate! Sorry it took us so long to merge this feature and its docs 🙏

@natewiebe13 natewiebe13 deleted the user-is-granted branch January 3, 2025 15:54
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.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.