mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 22:37:28 -08:00
Merge pull request #15084 from snipe/fixes_ldap_sync_locale
Fixes #15067 - updated ldap sync locale to use `app()->getLocale()`
This commit is contained in:
commit
0ac82fbbe1
|
@ -251,6 +251,7 @@ class LdapSync extends Command
|
||||||
// Creating a new user.
|
// Creating a new user.
|
||||||
$user = new User;
|
$user = new User;
|
||||||
$user->password = $user->noPassword();
|
$user->password = $user->noPassword();
|
||||||
|
$user->locale = app()->getLocale();
|
||||||
$user->activated = 1; // newly created users can log in by default, unless AD's UAC is in use, or an active flag is set (below)
|
$user->activated = 1; // newly created users can log in by default, unless AD's UAC is in use, or an active flag is set (below)
|
||||||
$item['createorupdate'] = 'created';
|
$item['createorupdate'] = 'created';
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class CheckLocale
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
\App::setLocale(Helper::mapLegacyLocale($language));
|
app()->setLocale(Helper::mapLegacyLocale($language));
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,6 +229,7 @@ class Ldap extends Model
|
||||||
$item['department'] = $ldapattributes[$ldap_result_dept][0] ?? '';
|
$item['department'] = $ldapattributes[$ldap_result_dept][0] ?? '';
|
||||||
$item['manager'] = $ldapattributes[$ldap_result_manager][0] ?? '';
|
$item['manager'] = $ldapattributes[$ldap_result_manager][0] ?? '';
|
||||||
$item['location'] = $ldapattributes[$ldap_result_location][0] ?? '';
|
$item['location'] = $ldapattributes[$ldap_result_location][0] ?? '';
|
||||||
|
$item['locale'] = app()->getLocale();
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +240,7 @@ class Ldap extends Model
|
||||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||||
* @since [v3.0]
|
* @since [v3.0]
|
||||||
* @param $ldapatttibutes
|
* @param $ldapatttibutes
|
||||||
* @return array|bool
|
* @return User | bool
|
||||||
*/
|
*/
|
||||||
public static function createUserFromLdap($ldapatttibutes, $password)
|
public static function createUserFromLdap($ldapatttibutes, $password)
|
||||||
{
|
{
|
||||||
|
@ -252,6 +253,7 @@ class Ldap extends Model
|
||||||
$user->last_name = $item['lastname'];
|
$user->last_name = $item['lastname'];
|
||||||
$user->username = $item['username'];
|
$user->username = $item['username'];
|
||||||
$user->email = $item['email'];
|
$user->email = $item['email'];
|
||||||
|
$user->locale = $item['locale'];
|
||||||
$user->password = $user->noPassword();
|
$user->password = $user->noPassword();
|
||||||
|
|
||||||
if (Setting::getSettings()->ldap_pw_sync == '1') {
|
if (Setting::getSettings()->ldap_pw_sync == '1') {
|
||||||
|
|
Loading…
Reference in a new issue