-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
allow using any ldap property as login name when using login credentials #24955
Conversation
…ge login credentials Signed-off-by: Robin Appelman <robin@icewind.nl>
5c8013e
to
58f3f5c
Compare
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.
Fine by me
🐘
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.
Fine with me too 👍
$access = $ldap->getLDAPAccess($user->getUID()); | ||
$connection = $access->getConnection(); | ||
$key = "external_login::" . $user->getUID() . "::" . $property; | ||
$cached = $connection->getFromCache($key); | ||
|
||
if ($cached !== null) { | ||
return $cached; | ||
} | ||
|
||
$value = $access->readAttribute($access->username2dn($user->getUID()), $property); | ||
if (count($value) > 0) { | ||
$value = current($value); | ||
} else { | ||
return null; | ||
} | ||
$connection->writeToCache($key, $value); |
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'd prefer it would use \OCP\ILDAPProvider (via its factory) instead of using private user_ldap classes. https://github.com/nextcloud/server/tree/master/lib/public/LDAP
Either way. It should not have been merged after feature freeze → Reverting |
When using ldap, there are setups where neither the uid nor the loginname are the "correct" username to pass to external storages.
This adds an option to use any ldap property as the username to pass to the external storage, you can configure it using