From 55ee906ba36cf66c3a390c98dde75e241de26e65 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 7 May 2016 18:05:33 -0400 Subject: Added support for language LDAP attribute --- app/User/LdapUserProvider.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'app/User/LdapUserProvider.php') diff --git a/app/User/LdapUserProvider.php b/app/User/LdapUserProvider.php index 3e2dcd2b..74cf4cd5 100644 --- a/app/User/LdapUserProvider.php +++ b/app/User/LdapUserProvider.php @@ -3,6 +3,7 @@ namespace Kanboard\User; use Kanboard\Core\User\UserProviderInterface; +use Kanboard\Model\Language; /** * LDAP User Provider @@ -68,6 +69,14 @@ class LdapUserProvider implements UserProviderInterface */ protected $photo = ''; + /** + * User language + * + * @access protected + * @var string + */ + protected $language = ''; + /** * Constructor * @@ -80,7 +89,7 @@ class LdapUserProvider implements UserProviderInterface * @param string[] $groupIds * @param string $photo */ - public function __construct($dn, $username, $name, $email, $role, array $groupIds, $photo = '') + public function __construct($dn, $username, $name, $email, $role, array $groupIds, $photo = '', $language = '') { $this->dn = $dn; $this->username = $username; @@ -89,6 +98,7 @@ class LdapUserProvider implements UserProviderInterface $this->role = $role; $this->groupIds = $groupIds; $this->photo = $photo; + $this->language = $language; } /** @@ -198,9 +208,13 @@ class LdapUserProvider implements UserProviderInterface */ public function getExtraAttributes() { - return array( - 'is_ldap_user' => 1, - ); + $attributes = array('is_ldap_user' => 1); + + if (! empty($this->language)) { + $attributes['language'] = Language::findCode($this->language); + } + + return $attributes; } /** -- cgit v1.2.3