-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
Add option to fetch specific user from LDAP #29451
Conversation
Signed-off-by: Guillaume COLSON <guillaume.colson@univ-lorraine.fr>
; | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int { | ||
try { | ||
$uid = $input->getArgument('ocName'); | ||
$this->isAllowed($input->getOption('force')); | ||
if ($input->getOption('fetch')) { | ||
$uid = $this->backend->loginName2UserName($uid); |
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.
check whether loginName2UserName()
returned false
– this is when the user was not found. Probably best to exit with a message in this case.
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.
In this case, we fall back to the default behavior.
As the user isn't mapped, the next call to $this->confirmUserIsMapped($uid);
will trigger the error
The given user is not a recognized LDAP user.
I thought that it would be enough. What do you think ?
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.
Since --fetch
has to be proactively used, my expectancy was that it really and only tries to fetch the user from LDAP first. The fallback might be undesired here (even if it does not hurt). Exiting with a new return code (2) is the best way to deal with this imo.
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.
I've added a commit to implement what you suggested.
Signed-off-by: Guillaume COLSON <guillaume.colson@univ-lorraine.fr>
Signed-off-by: Guillaume COLSON <guillaume.colson@univ-lorraine.fr>
@come-nc Thanks for your improvement and sorry for the late reply. I had few times to make the appropriate tests. I tried to fetch a new ldap user with Anyway, I tried to move the call to confirmUserIsMapped after the update but no changes. Maybe you should add a call to |
@goyome I think I tested check-ldap for newly-deleted users but not for newly-created users. When I find time I will look into fixing this as well. |
Thanks a lot 👍 |
Signed-off-by: Guillaume COLSON guillaume.colson@univ-lorraine.fr
Address issue #27948
This PR is meant to replace #29326 after discussing about it with @blizzz