Skip to content

Added a small note about dynamic role hierarchies #9865

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
wants to merge 3 commits into from

Conversation

javiereguiluz
Copy link
Member

This fixes #9745.

@dmaicher would this pull request be in line with your comments here: symfony/symfony#21853 (comment) ? Thanks!

@dmaicher
Copy link
Contributor

dmaicher commented Jun 1, 2018

@javiereguiluz seems good. Just wondering if we should also include the info that it might be possible to re-use existing Symfony classes for it?

Here symfony/symfony#21853 (comment) one only needs a custom RoleHierarchyInterface implementation and its possible to re-use Symfony's RoleHierarchyVoter.

Edit: or maybe that would be too detailed and then better to create a separate how-to page for it?

@javiereguiluz
Copy link
Member Author

Thanks for the review! I've reworded according to your comments. Is it OK now?

security.rst Outdated
you cannot override it dynamically (for example to store the role hierarchy
in a database). If you need that, create a custom
:doc:`security voter </security/voters>` that looks for the user roles in
the database. Another solution is to create a service that implements the
Copy link
Contributor

@dmaicher dmaicher Jun 1, 2018

Choose a reason for hiding this comment

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

maybe One solution is ... instead of Another ...? because technically creating your own RoleHierarchyVoter is exactly what the previous sentence suggests? 😊

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I think its fine as it is 😊

security.rst Outdated
you cannot override it dynamically (for example to store the role hierarchy
in a database). If you need that, create a custom
:doc:`security voter </security/voters>` that looks for the user roles in
the database. Another solution is to create a service that implements the
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I think its fine as it is 😊

@javiereguiluz
Copy link
Member Author

To be completely honest, I don't understand this phrase:

Another solution is to create a service that implements the RoleHierarchyInterface and inject it into your own RoleHierarchyVoter service.

What is this solution saying? Are we decorating the existing RoleHierarchyVoter? Are we replacing the original RoleHierarchyVoter provided by Symfony?

@dmaicher
Copy link
Contributor

dmaicher commented Jun 4, 2018

@javiereguiluz

What is this solution saying? Are we decorating the existing RoleHierarchyVoter? Are we replacing the original RoleHierarchyVoter provided by Symfony?

The problem in symfony/symfony#21853 is that Symfony's RoleHierarchyVoter service is removed in a compiler pass (when there is no security.role_hierarchy configured). So in that case you can just register your own RoleHierarchyVoter service.

@javiereguiluz
Copy link
Member Author

I'm afraid I still don't understand this 😓 Maybe @xabbuh or someone else can try to explain this differently? Thanks!

@javiereguiluz
Copy link
Member Author

@dmaicher after thinking a lot about this, I propose to remove the second solution proposed and leave just the first one. This way we explain the problem and provide our preferred solution based on voters. Is this OK to you? Thanks!

Copy link
Contributor

@dmaicher dmaicher left a comment

Choose a reason for hiding this comment

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

Ok fine for me :)

javiereguiluz added a commit that referenced this pull request Jun 28, 2018
…eguiluz)

This PR was squashed before being merged into the 2.8 branch (closes #9865).

Discussion
----------

Added a small note about dynamic role hierarchies

This fixes #9745.

@dmaicher would this pull request be in line with your comments here: symfony/symfony#21853 (comment) ? Thanks!

Commits
-------

5230e56 Added a small note about dynamic role hierarchies
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