Skip to content

Commit

Permalink
Copy over modified versions of core functions
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc committed Dec 18, 2023
1 parent eaa6072 commit ba801b6
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,44 @@ public function userExistsOnBackend($uid, $backendName) {
$needle = '<backend>' . $backendName . '</backend>';
Assert::assertNotFalse(strpos($this->getResponse()->getBody()->getContents(), $needle));
}

/**
* @override Given /^having a valid LDAP configuration$/
*/
public function havingAValidLDAPConfiguration() {
$this->asAn('admin');
$this->creatingAnLDAPConfigurationAt('/apps/user_ldap/api/v1/config');
$data = new TableNode([
['configData[ldapHost]', getenv('LDAP_HOST') ?: 'openldap'],
['configData[ldapPort]', '389'],
['configData[ldapBase]', 'dc=nextcloud,dc=ci'],
['configData[ldapAgentName]', 'cn=admin,dc=nextcloud,dc=ci'],
['configData[ldapAgentPassword]', 'admin'],
['configData[ldapUserFilter]', '(&(objectclass=inetorgperson))'],
['configData[ldapLoginFilter]', '(&(objectclass=inetorgperson)(uid=%uid))'],
['configData[ldapUserDisplayName]', 'displayname'],
['configData[ldapGroupDisplayName]', 'cn'],
['configData[ldapEmailAttribute]', 'mail'],
['configData[ldapConfigurationActive]', '1'],
]);
$this->settingTheLDAPConfigurationTo($data);
$this->asAn('');
}

/**
* @override Given /^modify LDAP configuration$/
*/
public function modifyLDAPConfiguration(TableNode $table) {
$originalAsAn = $this->currentUser;
$this->asAn('admin');
$configData = $table->getRows();
foreach ($configData as &$row) {
if (str_contains($row[0], 'Host') && getenv('LDAP_HOST')) {
$row[1] = str_replace('openldap', getenv('LDAP_HOST'), $row[1]);
}
$row[0] = 'configData[' . $row[0] . ']';
}
$this->settingTheLDAPConfigurationTo(new TableNode($configData));
$this->asAn($originalAsAn);
}
}

0 comments on commit ba801b6

Please sign in to comment.