protected function _nextGid()
{
try {
$search = $this->_ldap->search($this->_params['basedn'], $this->_filter, array('attributes' => array('gidnumber')));
} catch (Horde_Ldap_Exception $e) {
throw new Horde_Group_Exception($e);
}
if (!$search->count()) {
return 1;
}
$nextgid = 0;
foreach ($search as $entry) {
$nextgid = max($nextgid, $entry->getValue('gidnumber', 'single'));
}
return $nextgid + 1;
}