Skip to content

Commit

Permalink
create new function to manually add skeleton files
Browse files Browse the repository at this point in the history
  • Loading branch information
jasson99 committed Sep 2, 2020
1 parent d61a35b commit ed94c61
Showing 1 changed file with 38 additions and 5 deletions.
43 changes: 38 additions & 5 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,43 @@ public function resetOldLdapConfig() {
}
}

/**
* This function will allow us to manually add skeleton files
*
* @param array $usersAttributes
*
* @return void
* @throws Exception
*/
public function manuallyAddSkeletonFiles($usersAttributes) {
$skeletonDir = \getenv("SKELETON_DIR");
$revaRoot = \getenv("OCIS_REVA_DATA_ROOT");
if (!$skeletonDir) {
throw new Exception('Missing SKELETON_DIR environment variable, cannot copy skeleton files for OCIS');
}
if (!$revaRoot && OcisHelper::getDeleteUserDataCommand() !== false) {
foreach ($usersAttributes as $userAttributes) {
OcisHelper::recurseUpload(
$this->getBaseUrl(),
$skeletonDir,
$userAttributes['userid'],
$userAttributes['password']
);
}
} elseif (!$revaRoot) {
throw new Exception('Missing OCIS_REVA_DATA_ROOT environment variable, cannot copy skeleton files for OCIS');
} else {
foreach ($usersAttributes as $userAttributes) {
$user = $userAttributes['userid'];
$dataDir = $revaRoot . "data/$user/files";
if (!\file_exists($dataDir)) {
\mkdir($dataDir, 0777, true);
}
OcisHelper::recurseCopy($skeletonDir, $dataDir);
}
}
}

/**
* This function will allow us to send user creation requests in parallel.
* This will be faster in comparison to waiting for each request to complete before sending another request.
Expand Down Expand Up @@ -1202,11 +1239,7 @@ public function adminSendsUserCreationRequestUsingTheProvisioningApi($user, $pas
$setting["password"] = $password;
$setting["email"] = $email;
\array_push($settings, $setting);
$this->usersHaveBeenCreated(
true,
$settings,
'api'
);
$this->manuallyAddSkeletonFiles($settings);
} else {
$this->addUserToCreatedUsersList($user, $password);
}
Expand Down

0 comments on commit ed94c61

Please sign in to comment.