Commit db81e6c2 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

feat(ldap) Add Ldap\Link::add method to create entries

issue #1
parent 9a6e0541
......@@ -183,6 +183,25 @@ class Link
return new Result($this->cid, $result);
}
/**
* Add an entry to the LDAP
*
* @param string $dn The LDAP node to create
* @param array<string,string|array<string>> $attrs The attributes values to add
* @param array<array> $controls Controls to send along with the request
*
* @throws \FusionDirectory\Ldap\Exception
*/
public function add (string $dn, array $attrs, array $controls = []): Result
{
$result = ldap_add_ext($this->cid, $dn, $attrs, $controls);
if ($result === FALSE) {
throw new Exception('Add failed: '.ldap_error($this->cid));
}
return new Result($this->cid, $result);
}
/**
* Get exaustive list of object classes declared on the LDAP server
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment