Skip to content
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

Question : Creating user #232

Open
harikt opened this issue Feb 7, 2025 · 4 comments
Open

Question : Creating user #232

harikt opened this issue Feb 7, 2025 · 4 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers question Further information is requested

Comments

@harikt
Copy link
Contributor

harikt commented Feb 7, 2025

In the documentation of creating user https://stack.sylius.com/cookbook/admin_panel/security#create-a-user-entity , we are creating user from command bin/console make:user .

In monofony iirc the sylius user bundle was reused. Question is can we use sylius/user-bundle or other bundles to make this happen ?

@Prometee
Copy link
Contributor

Prometee commented Feb 7, 2025

Hello @harikt!

Yes you can and I already did it on my own Sylius Stack project but it requires you to copy many classes from SyliusCoreBundle and SyliusAdminBundle.

Here is a non exhaustive list of a minimal integration (No admin avatar image):

  • Copy the Core AdminUser entity and add the PHP Attributes to setup the doctrine entity (remove AvatarImage relation).
  • Add PHP attributes to set the various Constraints on the fields.
  • Copy the EventListeners CanonicalizerListener .
  • Copy the Form (removing AvatarImage relation.
  • Copy the user creation console command as well as the Command and CommandHandler and the related Exception.
  • Create a grid, a SYlius Resource config.
  • Add the admin user route to the main menu.
  • Copy templates and avoid copy of the LiveComponent (because there no avatar to handle).
  • Config twig hooks.
  • [optional] Tweak the login page to add forget password feature.

Adding the Avatar Image is possible too but requires much mre class and templates to copy from SyliusCore.

@Prometee Prometee added documentation Improvements or additions to documentation good first issue Good for newcomers question Further information is requested labels Feb 7, 2025
@harikt
Copy link
Contributor Author

harikt commented Feb 7, 2025

Thank you @Prometee . I was expecting some sort of symfony pack which will help to speed up the process.

@Prometee
Copy link
Contributor

Prometee commented Feb 7, 2025

Maybe a recipe can be setup to do this automatically, I know that @loic425 think about doing this for other kind of auto config.

@loic425
Copy link
Member

loic425 commented Feb 7, 2025

Yes, I've some Symfony packs that are on WIP state.
I'll have to finish them soon cause we need them in my company to start future projects.
As you know, I'm not in favour of using sylius user package. It's on the main repo, it's hard to maintain it with Symfony changes and there's a lot of way to handle authentications in a project. That's why there's no Symfony user package anymore, only extra tools.
My current work is only for admin users and it's using a DDD architecture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants