Skip to content

Commit 75a69a1

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 75a69a1

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
@@ -28,6 +28,7 @@ class LoginListener implements IEventListener {
2828
public function __construct(
2929
private IEventDispatcher $dispatcher,
3030
private Group_Proxy $groupBackend,
31+
private User_Proxy $userBackend,
3132
private IGroupManager $groupManager,
3233
private LoggerInterface $logger,
3334
private GroupMembershipMapper $groupMembershipMapper,
@@ -49,6 +50,9 @@ public function onPostLogin(IUser $user): void {
4950
]
5051
);
5152
$this->updateGroups($user);
53+
if ($user->getBackend() instanceof User_Proxy || $user->getBackend() instanceof User_LDAP) {
54+
$this->userBackend->loginName2UserName($user->getUID());
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)