mirror of
https://github.com/nextcloud/server.git
synced 2026-06-14 19:20:35 -04:00
fix(ldap): Refresh user ldap attributes on login
Otherwise when authentificating via SAML an user in the LDAP database, this is not done. Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
This commit is contained in:
parent
64c52006dd
commit
6672cf8a9a
2 changed files with 7 additions and 2 deletions
|
|
@ -10,6 +10,7 @@ namespace OCA\User_LDAP;
|
|||
|
||||
use OCA\User_LDAP\Db\GroupMembership;
|
||||
use OCA\User_LDAP\Db\GroupMembershipMapper;
|
||||
use OCP\Authentication\IApacheBackend;
|
||||
use OCP\DB\Exception;
|
||||
use OCP\EventDispatcher\Event;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
|
|
@ -49,6 +50,10 @@ class LoginListener implements IEventListener {
|
|||
]
|
||||
);
|
||||
$this->updateGroups($user);
|
||||
$backend = $user->getBackend();
|
||||
if ($backend instanceof IApacheBackend) {
|
||||
$backend->loginName2UserName($user->getUID(), true);
|
||||
}
|
||||
}
|
||||
|
||||
private function updateGroups(IUser $userObject): void {
|
||||
|
|
|
|||
|
|
@ -221,9 +221,9 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP
|
|||
* @param string $loginName
|
||||
* @return string|false
|
||||
*/
|
||||
public function loginName2UserName($loginName) {
|
||||
public function loginName2UserName($loginName, bool $forceLdapRefetch = false) {
|
||||
$id = 'LOGINNAME,' . $loginName;
|
||||
return $this->handleRequest($id, 'loginName2UserName', [$loginName]);
|
||||
return $this->handleRequest($id, 'loginName2UserName', [$loginName, $forceLdapRefetch]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue