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
New LDAPProvider for user_ldap #23992
Conversation
By analyzing the blame information on this pull request, we identified @MorrisJobke, @blizzz and @LukasReschke to be potential reviewers |
if ($backend instanceof IUserBackend && $backend->getBackendName() == USER_LDAP::BACKEND_NAME) { | ||
$this->backend = $backend; | ||
break; | ||
} |
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.
When calling the user_ldap provider from a testing app, I'm currently running into a problem here, somehow the 'LDAP' backend is not in the loop, maybe because it is called before the 'LDAP' backend is registered? I have tried to uninstall and install the testing app again, but to no avail. Maybe something is wrong with this approach.
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.
Possible. Do you have the code of the testing app available? In general some types of apps are being loaded first and before others, including authentication. So, if your test app has this type set, you might want to remove it. As a guess into the blue.
} | ||
return false; | ||
} | ||
} |
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.
Not sure whether the usage of login names and internal user names is correct
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.
Nope. loginnames and usernames differ. What you have often with LDAP is that a login name looks like "a.user" or "a.user@server.tld" while the username is based on the UUID which may look like "AB1234C5-678D-9E01-2E34-F567GHI89012". Basically, you'd just remove if($userName = $this->backend->loginName2UserName($uid)){
.
You should always operate with usernames, not login names as they don't necessarily need to be unique.
If your callee uses the loginname instead of the username: if the user is logged in, you'll get the username from \OC::$server->getUserSession()->getUser()
. This returns null
or an IUser
object. In the first cast, it's an error and maybe you just want to throw an exception. In the normal case you'll get the username from getUID() of the IUser instance.
Comments are inline, many taken out directly from my IDE ;) Smaller issues in general. Three things remain, the first two low hanging fruits:
|
Thanks a lot @blizzz for taking time to go through the mess Ok, I should have all that ready by tomorrow. Meanwhile I have commited the testing app here. Currently the appinfo/app.php simply tries to initialize user_ldap's LDAPProvider and as mentioned above, it fails. The types in appinfo/info.xml are empty. To understand what the app is going to do later, lib/hooks.php and lib/ldap.php could give an impression. |
@@ -1 +1 @@ | |||
Subproject commit 509385e674563e48a977bf8285c826963835528e | |||
Subproject commit 16f2894332848adba757cc7add9d21a4ff1a6d18 |
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.
intentionally?
Thanks a lot @blizzz for your comments, they are implemented and committed. As discussed in IRC, the next step would be to implement unit tests to test all the public functions exposed by the LDAPProvider. |
Thanks a lot for your contribution! Alternatively you can add a comment here where you state that this contribution is MIT licensed. Some more details about out pull request workflow can be found here: http://owncloud.org/code-reviews-on-github/ |
Is this PR targeted for implementation in 9.2? I'm looking forward to implementing it in my app to map UUID to owncloud_name in order to support LDAP in instances where the internal UUID mapping is set to the default. |
@jvillafanez @DeepDiver1975 @owncloud/ldap |
The changes seem big enough to be considered almost a new app, because I don't think it was originally planned the app contains such changes.
|
I switched to Nextcloud and I don't have the resources to maintain this PR in ownCloud. Sorry for any inconvenience caused. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
New LDAPProvider for user_ldap, please refer to #23855