Skip to content

Commit 0b1c851

Browse files
author
Carl Schwan
committed
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 <[email protected]>
1 parent 64c5200 commit 0b1c851

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

apps/user_ldap/lib/LoginListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public function onPostLogin(IUser $user): void {
4949
]
5050
);
5151
$this->updateGroups($user);
52+
$backend = $user->getBackend();
53+
if ($backend instanceof User_Proxy) {
54+
$backend->loginName2UserName($user->getUID(), true);
55+
}
5256
}
5357

5458
private function updateGroups(IUser $userObject): void {

apps/user_ldap/lib/User_Proxy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ public function checkPassword($uid, $password) {
221221
* @param string $loginName
222222
* @return string|false
223223
*/
224-
public function loginName2UserName($loginName) {
224+
public function loginName2UserName($loginName, bool $forceLdapRefetch = false) {
225225
$id = 'LOGINNAME,' . $loginName;
226-
return $this->handleRequest($id, 'loginName2UserName', [$loginName]);
226+
return $this->handleRequest($id, 'loginName2UserName', [$loginName, $forceLdapRefetch]);
227227
}
228228

229229
/**

0 commit comments

Comments
 (0)