From 5cb89cd6c34b95626d2a438873d3a8279dfb571a Mon Sep 17 00:00:00 2001 From: Xpesir Date: Tue, 19 Jul 2022 20:26:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BB=8Eldap=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E7=94=A8=E6=88=B7=E8=B4=A6=E5=8F=B7=E4=B8=BA=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=90=8D=E8=80=8C=E4=B8=8D=E6=98=AFldap=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/LDAPService.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Services/LDAPService.php b/app/Services/LDAPService.php index f7f12c48..8ea5c70a 100755 --- a/app/Services/LDAPService.php +++ b/app/Services/LDAPService.php @@ -120,6 +120,7 @@ class LDAPService $users = Adldap::search()->users()->get(); $users = json_decode($users, true); foreach ($users as $user) { + $user_account = $user['samaccountname'][0]; $user_name = $user['cn'][0]; $user_dns = $user['distinguishedname'][0]; $user_dn_array = explode(',', $user_dns); @@ -134,10 +135,10 @@ class LDAPService $department_id = $department->id; } } - $user = User::withTrashed()->where('name', $user_name)->first(); + $user = User::withTrashed()->where('username', $user_account)->first(); if (empty($user)) { $user = new User(); - $user->username = $user_name; + $user->username = $user_account; $user->password = bcrypt($user->username); $user->name = $user_name; $user->department_id = $department_id;