- // ldap groups refresh
- if (config('services.ldap.user_to_groups') !== false && $request->filled('username')) {
- $ldapRepo = new LdapRepo($this->userRepo);
- $ldapRepo->syncGroups($user,$request->input('username'));
- }
-
+ // Sync LDAP groups if required
+ if ($this->ldapService->shouldSyncGroups()) {
+ $this->ldapService->syncGroups($user);
+ }