public function testHasValue() { $entry = new Entry($this->entry); $this->assertTrue($entry->hasValue('mail', 'user2@localhost')); $this->assertFalse($entry->hasValue('mail', 'user3@localhost')); $this->assertTrue($entry->hasValue('displayname', 'My LDAP user')); $this->assertFalse($entry->hasValue('displayname', 'Something else')); }
/** * 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; }