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

Add commands from FOSUserBundle #1484

Merged
merged 14 commits into from
Jan 30, 2022

Conversation

jordisala1991
Copy link
Member

@jordisala1991 jordisala1991 commented Jan 27, 2022

Subject

I am targeting this branch, because here is where commands are not present because of removal of FOSUserBundle.

Part of #1465

Changelog

### Added
- Added `sonata:user:create` command from FOSUserBundle
- Added `sonata:user:promote` command from FOSUserBundle
- Added `sonata:user:demote` command from FOSUserBundle
- Added `sonata:user:change-password` command from FOSUserBundle
- Added `sonata:user:activate` command from FOSUserBundle
- Added `sonata:user:deactivate` command from FOSUserBundle

@jordisala1991 jordisala1991 changed the base branch from 4.x to 5.x January 27, 2022 08:03
@jordisala1991 jordisala1991 changed the title Feature/add commands Add commands from FOSUserBundle Jan 27, 2022
@jordisala1991 jordisala1991 force-pushed the feature/add-commands branch 2 times, most recently from 3bdabf7 to 5328f0c Compare January 29, 2022 09:05
@jordisala1991 jordisala1991 force-pushed the feature/add-commands branch 2 times, most recently from 8a308fe to 3700471 Compare January 29, 2022 09:11

$user = $this->refreshUser($user);

// static::assertSame($user->getPassword(), 'new_password');
Copy link
Member Author

Choose a reason for hiding this comment

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

The password is not really changed.

That's because the plainPassword field is not managed by Doctrine, so if we only modify this it is unable to know something changed and trigger the preUpdate lifecycle event.

On FOSUserBundle , the UserManager "save" method does not only save the object but also updated the canonical fields and the password. Should we do the same?

It will also affect the UserAdmin when you only change password, so we should do the same there.

wdyt @VincentLanglet ? At the end we have some duplicated things. The preUpdate event and the code on the manager and the admin.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed by adding the updatePassword to the ModelManager, not sure if I like it a lot but it works.

@jordisala1991 jordisala1991 marked this pull request as ready for review January 30, 2022 15:43
<files psalm-version="4.19.0@a2ad69ae4f5ab1f7d225a8dc4e2ec2d9415ed599">
<file src="src/Action/LoginAction.php">
<UndefinedInterfaceMethod occurrences="1">
<code>getFlashBag</code>
Copy link
Member

Choose a reason for hiding this comment

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

Soon, it won't be needed psalm/psalm-plugin-symfony#242 ;)

@jordisala1991 jordisala1991 merged commit b16612e into sonata-project:5.x Jan 30, 2022
@jordisala1991 jordisala1991 deleted the feature/add-commands branch January 30, 2022 18:10
@jordisala1991
Copy link
Member Author

Lets add this now, to not block other Prs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants