-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[UserBundle] adding commands to promote or demote a user by adding or removing a role #4212
[UserBundle] adding commands to promote or demote a user by adding or removing a role #4212
Conversation
loic425
commented
Feb 18, 2016
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Fixed tickets | |
License | MIT |
Doc PR |
if (empty($email)) { | ||
throw new \Exception('Email can not be empty'); | ||
} | ||
return $email; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing blank line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines are a copy/paste from existing "CreateUserCommand".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still, there should be a blank line before return statement. See
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, my bad. I'm gonna fix that.
@pjedrzejewski Theses 2 commands handle with RBAC roles now. I omitted this concept. |
|
||
/** | ||
* @param string $role | ||
* @return RoleInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing blank line
@pjedrzejewski I've done all changes from lchrusciel review. |
@pjedrzejewski @lchrusciel |
/** | ||
* @author Loïc Frémont <loic@mobizel.com> | ||
*/ | ||
interface RoleCommandInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this interface? You do not inject it anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbstractRoleCommand object use this interface. This command calls "executeRoleCommand" method. Thus, to extend AbstractRoleCommand, you need to add executeRoleCommand method.
*/ | ||
protected function findAuthorizationRole($role) | ||
{ | ||
$roleRepository = $this->getContainer()->get('sylius.repository.role'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This couples SyliusUserBundle to SyliusRbacBundle, which is something we would like to avoid. Sorry, I just noticed it. I think there should be a separate command in RbacBundle to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pjedrzejewski
Ok, I see. The actual CreateUserCommand has the same problem.
I'm gonna work (if you agree) on two commands, one for SyliusUserBundle and one for SyliusRbacBundle.
I can also work on another pull request to improve CreateUserCommand.
This coupling to RbacBundle is a blocker atm. :/ We cannot use |
@pjedrzejewski |
->setHelp(<<<EOT | ||
The <info>sylius:user:demote</info> command demotes a user by removing security roles | ||
|
||
<info>php app/console fos:user:demote matthieu@email.com</info> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sylius:user:demote
Thank you @loic425! |