8000 Custom Expression Language function not working in security.yml allow_if · Issue #23208 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Custom Expression Language function not working in security.yml allow_if #23208

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

Closed
syrm opened this issue Jun 16, 2017 · 11 comments
Closed

Custom Expression Language function not working in security.yml allow_if #23208

syrm opened this issue Jun 16, 2017 · 11 comments

Comments

@syrm
Copy link
syrm commented Jun 16, 2017
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.2.9

It's exactly the same problem of this issue : #21305

Except i using it in securty.yml allow_if and i got :
Error: The function "test" does not exist around position 1.

With @Security annotation everything is ok.

@xabbuh
Copy link
Member
xabbuh commented Jul 6, 2017

Can you provide a small example project that makes it possible to reproduce your issue?

@syrm
Copy link
Author
syrm commented Jul 10, 2017

@xabbuh
Copy link
Member
xabbuh commented Jul 10, 2017

Status: Reviewed

@xabbuh
Copy link
Member
xabbuh commented Jul 10, 2017

Thanks, I can confirm the issue. The allow_if expression is being evaluated during container compilation when the SecurityExtension is processed. However, at this stage, the custom expression language provider are not available as the compiler pass has not been processed. I am not sure how to fix this though.

@ordermind
Copy link

The natural solution in my mind is to move the parsing of authorization-related expression so that at least compiler passes are processed first. It seems incredibly early to parse the expressions at that stage. Is there any good reason why it must be done that way or is it an oversight?

@dmaicher
Copy link
Contributor

I ran into the same problem today and opened a PR to discuss possible solutions: #24309

@syrm
Copy link
Author
syrm commented Feb 20, 2018

Still not fixed ? :-(

@fabpot
Copy link
Member
fabpot commented Feb 20, 2018

@syrm Apparently, nobody took the time to investigate the issue to find a solution and propose a pull request.

@dmaicher
Copy link
Contributor

@syrm I came up with an idea but it was not optimal 😢 Did not have time yet to re-check.
Feel free to look into it yourself.

@syrm
Copy link
Author
syrm commented Feb 21, 2018

thank you everyone for your answers

@dmaicher
Copy link
Contributor
dmaicher commented Feb 21, 2018

See #26660

@fabpot fabpot closed this as completed Apr 6, 2018
fabpot added a commit that referenced this issue Apr 6, 2018
…low_if expressions (dmaicher)

This PR was merged into the 4.1-dev branch.

Discussion
----------

[SecurityBundle] allow using custom function inside allow_if expressions

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | no
| Fixed tickets | #23208
| License       | MIT
| Doc PR        | symfony/symfony-docs#9552

This is a follow-up for #26263

As discussed there I propose to allow using custom functions as a new feature only and thus targeting `master` here.

If we agree to move forward with this there are some todos:
- [x] fix tests
- [x] add cache warmer for allow_if expressions
- [x] update documentation to mention this new feature
- [x] update UPGRADE files

ping @nicolas-grekas @stof

Commits
-------

41552cd [SecurityBundle] allow using custom function inside allow_if expressions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants
0