/** * Find a group from a search query * * @access public * @param string $input * @return LdapGroupProvider[] */ public function find($input) { try { $ldap = LdapClient::connect(); return LdapGroup::getGroups($ldap, $this->getLdapGroupPattern($input)); } catch (LdapException $e) { $this->logger->error($e->getMessage()); return array(); } }
/** * Get user groupIds (DN) * * 1) If configured, use memberUid and posixGroup * 2) Otherwise, use memberOf * * @access protected * @param Entry $entry * @param string $username * @return string[] */ protected function getGroups(Entry $entry, $username) { $groupIds = array(); if (!empty($username) && $this->group !== null && $this->hasGroupUserFilter()) { $groups = $this->group->find(sprintf($this->getGroupUserFilter(), $username)); foreach ($groups as $group) { $groupIds[] = $group->getExternalId(); } } else { $groupIds = $entry->getAll($this->getAttributeGroup()); } return $groupIds; }
public function testGetBaseDnNotConfigured() { $this->setExpectedException('\\LogicException'); $group = new Group($this->query); $group->getBasDn(); }