Skip to content

Allow specifying attributes for RequestMatcher #17388

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
Oct 24, 2022

Conversation

mdoutreluingne
Copy link
Contributor

@mdoutreluingne mdoutreluingne commented Oct 23, 2022

fixes #17377

Could you help me with the XML and PHP formats.

  • Add YAML example format
  • Add XML example format
  • Add PHP example format

@carsonbot carsonbot added this to the 6.2 milestone Oct 23, 2022
@carsonbot carsonbot changed the title [SecurityBundle][WIP] Allow specifying attributes for RequestMatcher [WIP] Allow specifying attributes for RequestMatcher Oct 23, 2022
Copy link
Member

@wouterj wouterj left a comment

Choose a reason for hiding this comment

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

Thank you!

The other formats would look like this:

<rule role="ROLE_ADMIN">
    <attribute key="_route">admin</attribute>
</rule>

<rule route="admin" role="ROLE_ADMIN"/>

(btw, you were actually right - XML was not yet supported for this setting, I've contributed a fix: symfony/symfony#47959 )

$security->accessControl()
    ->roles(['ROLE_ADMIN'])
    ->attributes(['_route' => 'admin'])
;

$security->accessControl()
    ->roles(['ROLE_ADMIN'])
    ->route('admin')
;

@mdoutreluingne mdoutreluingne changed the title [WIP] Allow specifying attributes for RequestMatcher [WCM] Allow specifying attributes for RequestMatcher Oct 23, 2022
@OskarStark
Copy link
Contributor

What does WCM in the title means?

@mdoutreluingne
Copy link
Contributor Author

mdoutreluingne commented Oct 23, 2022

WCM means 'Waiting Code Merge', Wouter has created a PR to add the XML format

@wouterj wouterj changed the title [WCM] Allow specifying attributes for RequestMatcher Allow specifying attributes for RequestMatcher Oct 23, 2022
@wouterj
Copy link
Member

wouterj commented Oct 23, 2022

Ready to go 🚀

@OskarStark
Copy link
Contributor

Thank you Maxime.

@OskarStark OskarStark merged commit b50517d into symfony:6.2 Oct 24, 2022
@mdoutreluingne mdoutreluingne deleted the fix_17377 branch October 24, 2022 16:27
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.

[SecurityBundle] Allow specifying attributes for RequestMatcher
4 participants