-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Allow using expressions with the #[IsGranted] attribute #46978
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
Conversation
src/Symfony/Component/Security/Http/EventListener/IsGrantedAttributeListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Tests/EventListener/IsGrantedAttributeListenerTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/EventListener/IsGrantedAttributeListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/EventListener/IsGrantedAttributeListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/EventListener/IsGrantedAttributeListener.php
Show resolved
Hide resolved
src/Symfony/Bundle/SecurityBundle/Resources/config/security.php
Outdated
Show resolved
Hide resolved
bdd0c16
to
3957a98
Compare
src/Symfony/Component/Security/Http/Tests/EventListener/IsGrantedAttributeListenerTest.php
Outdated
Show resolved
Hide resolved
3957a98
to
8de7c8f
Compare
src/Symfony/Component/Security/Core/Exception/AccessDeniedException.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$accessDeniedException->setAttributes($attribute->attributes);
Don't we want to provide the resolved values instead? That would solve the issue with accepting Expression into AccessDeniedException and might improve debugging?
src/Symfony/Bundle/SecurityBundle/Resources/config/security.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/EventListener/IsGrantedAttributeListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/EventListener/IsGrantedAttributeListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/EventListener/IsGrantedAttributeListener.php
Outdated
Show resolved
Hide resolved
7c38656
to
3d81940
Compare
@nicolas-grekas The problem is that the attributes expression is evaluated by the symfony/src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php Lines 67 to 74 in 9d7ff0c
Also, if I'm not mistaking, the result of the expression is always |
3d81940
to
91dff71
Compare
91dff71
to
0eb6bd8
Compare
@nicolas-grekas Was this closed by accident or did I miss something ? |
Indeed, this is a mistake because of the other PR description |
0eb6bd8
to
f5cee77
Compare
Thank you @HypeMC. |
… (HypeMC) This PR was merged into the 6.2 branch. Discussion ---------- [Security] Use expression for `#[IsGranted()]` subject symfony/symfony#46978 symfony/symfony#48080 symfony/symfony#48102 Commits ------- 9d4045f [Security] Use expression for #[IsGranted()] subject
… (HypeMC) This PR was merged into the 6.2 branch. Discussion ---------- [Security] Use expression for `#[IsGranted()]` subject symfony/symfony#46978 symfony/symfony#48080 symfony/symfony#48102 Commits ------- 9d4045f [Security] Use expression for #[IsGranted()] subject
Allows using the expression language with the
#[IsGranted]
attribute: