Skip to content

Commit 26a7206

Browse files
committed
Add method to update entries
1 parent cd5bd5e commit 26a7206

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

lib/Connector/Ldap.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Ldap implements ConnectorInterface
2626
use LdapHelpers;
2727

2828
/**
29-
* @var \Symfony\Component\Ldap\Adapter\ExtLdap\Adapter
29+
* @var \Symfony\Component\Ldap\Adapter
3030
*/
3131
protected Adapter $adapter;
3232

@@ -81,6 +81,15 @@ public function __construct(
8181
}
8282

8383

84+
/**
85+
* @return \Symfony\Component\Ldap\Adapter
86+
*/
87+
public function getAdapter(): Adapter
88+
{
89+
return $this->adapter;
90+
}
91+
92+
8493
/**
8594
* @inheritDoc
8695
*/
@@ -198,4 +207,20 @@ protected function resolveBindError(InvalidCredentialsException $e): string
198207
{
199208
return self::ERR_WRONG_PASS;
200209
}
210+
211+
212+
/**
213+
* @param \Symfony\Component\Ldap\Entry $entry
214+
* @return bool
215+
*/
216+
public function updateEntry(Entry $entry): bool
217+
{
218+
try {
219+
$this->adapter->getEntryManager()->update($entry);
220+
return true;
221+
} catch (LdapException $e) {
222+
Logger::warning($e->getMessage());
223+
return false;
224+
}
225+
}
201226
}

0 commit comments

Comments
 (0)