Add option to fetch specific user from LDAP#29451
Add option to fetch specific user from LDAP#29451goyome wants to merge 3 commits intonextcloud:masterfrom
Conversation
Signed-off-by: Guillaume COLSON <[email protected]>
| $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.
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.
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.
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.
I've added a commit to implement what you suggested.
Signed-off-by: Guillaume COLSON <[email protected]>
Signed-off-by: Guillaume COLSON <[email protected]>
|
@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 [email protected]
Address issue #27948
This PR is meant to replace #29326 after discussing about it with @blizzz