|
|
<?php |
|
|
|
|
|
namespace Kanboard\User; |
|
|
|
|
|
use Kanboard\Core\User\UserProviderInterface; |
|
|
use Kanboard\Model\LanguageModel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LdapUserProvider implements UserProviderInterface |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $dn; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $username; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $name; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $email; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $role; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $groupIds; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $photo = ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $language = ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function __construct($dn, $username, $name, $email, $role, array $groupIds, $photo = '', $language = '') |
|
|
{ |
|
|
$this->dn = $dn; |
|
|
$this->username = $username; |
|
|
$this->name = $name; |
|
|
$this->email = $email; |
|
|
$this->role = $role; |
|
|
$this->groupIds = $groupIds; |
|
|
$this->photo = $photo; |
|
|
$this->language = $language; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function isUserCreationAllowed() |
|
|
{ |
|
|
return LDAP_USER_CREATION; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getInternalId() |
|
|
{ |
|
|
return 0; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getExternalIdColumn() |
|
|
{ |
|
|
return 'username'; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getExternalId() |
|
|
{ |
|
|
return $this->getUsername(); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getRole() |
|
|
{ |
|
|
return $this->role; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getUsername() |
|
|
{ |
|
|
return LDAP_USERNAME_CASE_SENSITIVE ? $this->username : strtolower($this->username); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getName() |
|
|
{ |
|
|
return $this->name; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getEmail() |
|
|
{ |
|
|
return $this->email; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getExternalGroupIds() |
|
|
{ |
|
|
return $this->groupIds; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getExtraAttributes() |
|
|
{ |
|
|
$attributes = array('is_ldap_user' => 1); |
|
|
|
|
|
if (! empty($this->language)) { |
|
|
$attributes['language'] = LanguageModel::findCode($this->language); |
|
|
} |
|
|
|
|
|
return $attributes; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getDn() |
|
|
{ |
|
|
return $this->dn; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getPhoto() |
|
|
{ |
|
|
return $this->photo; |
|
|
} |
|
|
} |
|
|
|