Skip to content

Command, allow to search User by Email#4

Open
n3ss wants to merge 1 commit into
masterfrom
feature/command-findByEmail
Open

Command, allow to search User by Email#4
n3ss wants to merge 1 commit into
masterfrom
feature/command-findByEmail

Conversation

@n3ss
Copy link
Copy Markdown

@n3ss n3ss commented May 28, 2019

Add a new option for the "biig:jwt:generate"
This option allow to search an User by its Email

@n3ss n3ss self-assigned this May 28, 2019
@n3ss n3ss added the enhancement New feature or request label May 28, 2019
@n3ss n3ss requested a review from Nek- May 28, 2019 13:58
Copy link
Copy Markdown
Contributor

@Nek- Nek- left a comment

Choose a reason for hiding this comment

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

Nice contribution thanks. Please take a look to the feedback I did.

if ($input->hasOption('role')
if ($input->hasOption('email')
&& null !== $input->getOption('email'))
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wow, how did it happen like that? Please fix indentation.

if (!$find) {
$output->writeln(sprintf('<error>User with role "%s" doesn\'t exist.<error>', $input->getOption('role')));
&& !in_array($input->getOption('role'), $user->getRoles()))
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👀 same here

&& !in_array($input->getOption('role'), $user->getRoles()))
{
$user = $this->findOneByRole($input, $output, $users);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we specify email and role, role will be ignored. This is due to refactoring in splitted methods. You probably should consider to add an error message or drop this refactoring and use a single (fat, I admit) condition.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm assuming that if you use the 'email' flag you must know which user you want and therefore you need to know which role this user have

@Nek-
Copy link
Copy Markdown
Contributor

Nek- commented Jun 11, 2019

@megan3ss ping :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants