Skip to content

[Security] document current user attribute in the main security doc entry #20864

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

Open
wants to merge 1 commit into
base: 7.2
Choose a base branch
from

Conversation

94noni
Copy link
Contributor

@94noni 94noni commented Apr 7, 2025

I know its documented rapidly (via a code diff example) on top of this file
but here on a controller I thinks its more usefull rather than using the getUser of the abstract controller
wdyt?

also unrelated but, would it be possible to display the class name here ?
seeing only getUser can be misleading, what about Security::getUser
because getUser is globally generic in the codebase
Capture d’écran 2025-04-07 à 09 38 21

@@ -2100,6 +2101,11 @@ accessed via the ``getUser()`` shortcut in the
// For example, if you added a getFirstName() method, you can use that.
return new Response('Well hi there '.$user->getFirstName());
}

public function me(#[CurrentUser] User $user): Response
Copy link
Member

Choose a reason for hiding this comment

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

What about unauthenticated users?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good question, should I add an IsGranted above the action? :)

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.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy