Added tests to cover ldap group mapping

Also updated .env.example formatting.
Updated how LdapRepo uses Ldap so can be mocked by testing.
This commit is contained in:
Dan Brown
2018-07-15 17:57:25 +01:00
parent 1776204870
commit 17bca662a7
4 changed files with 126 additions and 13 deletions

View File

@ -6,6 +6,7 @@ use BookStack\Exceptions\AuthException;
use BookStack\Http\Controllers\Controller;
use BookStack\Repos\UserRepo;
use BookStack\Repos\LdapRepo;
use BookStack\Services\LdapService;
use BookStack\Services\SocialAuthService;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
@ -99,7 +100,7 @@ class LoginController extends Controller
// ldap groups refresh
if (config('services.ldap.user_to_groups') !== false && $request->filled('username')) {
$ldapRepo = new LdapRepo($this->userRepo);
$ldapRepo = new LdapRepo($this->userRepo, app(LdapService::class));
$ldapRepo->syncGroups($user, $request->input('username'));
}