|
|
<?php |
|
|
|
|
|
namespace Kanboard\Core\Ldap; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Entry |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $entry = array(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function __construct(array $entry) |
|
|
{ |
|
|
$this->entry = $entry; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getAll($attribute) |
|
|
{ |
|
|
$attributes = array(); |
|
|
|
|
|
if (! isset($this->entry[$attribute]['count'])) { |
|
|
return $attributes; |
|
|
} |
|
|
|
|
|
for ($i = 0; $i < $this->entry[$attribute]['count']; $i++) { |
|
|
$attributes[] = $this->entry[$attribute][$i]; |
|
|
} |
|
|
|
|
|
return $attributes; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getFirstValue($attribute, $default = '') |
|
|
{ |
|
|
return isset($this->entry[$attribute][0]) ? $this->entry[$attribute][0] : $default; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getDn() |
|
|
{ |
|
|
return isset($this->entry['dn']) ? $this->entry['dn'] : ''; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function hasValue($attribute, $value) |
|
|
{ |
|
|
$attributes = $this->getAll($attribute); |
|
|
return in_array($value, $attributes); |
|
|
} |
|
|
} |
|
|
|