Skip to content

Differentiate between role name and role key #179

@alexander-schranz

Description

@alexander-schranz

Discussed in #177

Originally posted by RafaelKr December 3, 2024
We're creating a role called Portal Customer. We'd like to use the role key portal_customer for that. Especially because for Symfony the role would be called ROLE_SULU_PORTAL CUSTOMER (note the space) without setting the key.

I'd like to create a PR, but we have the following options:

  1. Create a new configuration key in config/packages/sulu_community.yaml with the path sulu_community.website.role_name corresponding to the role configuration option.

  2. Create the PR to https://github.com/sulu/sulu and adjust the following line to replace spaces with underscores: https://github.com/sulu/sulu/blob/15a676466de29d815d016b37dd7cb97fef1cc76d/src/Sulu/Bundle/SecurityBundle/Entity/Role.php#L130. Of course this would be a breaking change so the PR would be against the 3.0 branch.
    Also the AsciiSlugger could be used which is available from Symfony 5.0, using _ as the seperator.

  3. Doing both PRs

What is your preferred approach to that? Of course I'm open to other solutions too.

Edit: AsciiSlugger is available starting from Symfony 5.0, before I told it's available from 7.1 as that is what the version selector in the documentation suggested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions