[tests-only][full-ci] test: set up Keycloak users via HTTP instead of Web UI (#12930)
test: fix user mfa setup for vauld Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>
This commit is contained in:
1 parent
d58071bbd9
commit
3e3bb41132
8 files changed
+233
-311
No files matched your search
@@ -95,7 +95,7 @@ jobs:
|
||||
chmod +x k3d
|
||||
sudo mv k3d /usr/local/bin/
|
||||
k3d version
|
||||
|
||||
|
||||
- name: Install Helm
|
||||
run: |
|
||||
curl -fsSL -o helm-${{ env.HELM_VERSION }}-linux-amd64.tar.gz https://get.helm.sh/helm-${{ env.HELM_VERSION }}-linux-amd64.tar.gz
|
||||
@@ -221,7 +221,7 @@ jobs:
|
||||
if [[ "${{ matrix.suite }}" == "apiOcm" ]]; then
|
||||
OCM=true make deploy-ocis
|
||||
fi
|
||||
|
||||
|
||||
- name: Wait for oCIS to be ready
|
||||
env:
|
||||
FILE_URL: ${{ env.TEST_SERVER_URL }}/remote.php/dav/files/admin/hello1.txt
|
||||
@@ -333,17 +333,6 @@ jobs:
|
||||
--skip-ocis-run \
|
||||
-n ocis-server &
|
||||
|
||||
- name: Install Playwright for vault tests
|
||||
if: matrix.suite == 'apiVault'
|
||||
run: |
|
||||
composer install --no-progress
|
||||
composer bin behat install --no-progress
|
||||
vendor-php/bin/playwright-install
|
||||
vendor-php/bin/playwright-install --browsers
|
||||
env:
|
||||
COMPOSER_NO_INTERACTION: "1"
|
||||
COMPOSER_NO_AUDIT: "1"
|
||||
|
||||
- name: Prepare expected failures
|
||||
if: startsWith( matrix.suite, 'core' )
|
||||
env:
|
||||
|
||||
+1
-3
@@ -11,8 +11,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-simplexml": "*",
|
||||
"bamarni/composer-bin-plugin": "^1.8",
|
||||
"playwright-php/playwright": "^1.2"
|
||||
"bamarni/composer-bin-plugin": "^1.8"
|
||||
},
|
||||
"extra": {
|
||||
"bamarni-bin": {
|
||||
@@ -20,7 +19,6 @@
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"khanamiryan/qrcode-detector-decoder": "^2.0",
|
||||
"spomky-labs/otphp": "^11.5"
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,14 @@
|
||||
|
||||
namespace TestHelpers;
|
||||
|
||||
require_once __DIR__ . '/../../../vendor-php/autoload.php';
|
||||
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
use JsonException;
|
||||
use OTPHP\TOTP;
|
||||
use ParagonIE\ConstantTime\Base32;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
@@ -45,6 +49,11 @@ class KeycloakHelper {
|
||||
'ocisGuest' => '7eedfa6d-a2d9-4296-b6db-e75e4e9c0963',
|
||||
'offline_access' => 'e2145b30-bf6f-49fb-af3f-1b40168bfcef',
|
||||
];
|
||||
// Longest known step sequence in getCode()'s MFA loop, with one spare step of headroom:
|
||||
// password POST -> TOTP setup form -> submit -> intermediate redirect -> GET-follow ->
|
||||
// OTP challenge form -> submit -> final redirect (7 steps), so 8 never truncates a real
|
||||
// flow while still bounding it against an infinite loop.
|
||||
private const MAX_MFA_FLOW_STEPS = 8;
|
||||
private static ?string $adminAccessToken = null;
|
||||
private static ?int $adminAccessTokenExpiry = null;
|
||||
|
||||
@@ -343,10 +352,12 @@ class KeycloakHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $acrValues
|
||||
*
|
||||
* @return array
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getAuthorizationEndPoint(): array {
|
||||
public static function getAuthorizationEndPoint(?string $acrValues = null): array {
|
||||
$loginParams = [
|
||||
'client_id' => 'web',
|
||||
'redirect_uri' => OcisHelper::getServerUrl() . '/oidc-callback.html',
|
||||
@@ -354,6 +365,9 @@ class KeycloakHelper {
|
||||
'response_type' => 'code',
|
||||
'scope' => 'openid profile email acr',
|
||||
];
|
||||
if ($acrValues !== null) {
|
||||
$loginParams['acr_values'] = $acrValues;
|
||||
}
|
||||
$queryString = \http_build_query($loginParams);
|
||||
$authUrl = self::getKeycloakUrl() . "/realms/oCIS/protocol/openid-connect/auth?" . $queryString;
|
||||
$response = HttpRequestHelper::get(
|
||||
@@ -375,9 +389,14 @@ class KeycloakHelper {
|
||||
*
|
||||
* @return string
|
||||
* @throws GuzzleException
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getCode(array $user, string $authorizationUrl, string $cookie): string {
|
||||
$authCodeResponse = HttpRequestHelper::post(
|
||||
public static function getCode(
|
||||
array $user,
|
||||
string $authorizationUrl,
|
||||
string $cookie,
|
||||
): string {
|
||||
$response = HttpRequestHelper::post(
|
||||
$authorizationUrl,
|
||||
null,
|
||||
null,
|
||||
@@ -389,9 +408,120 @@ class KeycloakHelper {
|
||||
'password' => $user['password'],
|
||||
],
|
||||
);
|
||||
$locationHeader = $authCodeResponse->getHeader('Location');
|
||||
$queryString = parse_url($locationHeader[0], PHP_URL_QUERY);
|
||||
parse_str($queryString, $urlParams);
|
||||
|
||||
// Whatever step-up Keycloak asks for next (first-time "configure TOTP", since this
|
||||
// user has no credential yet, or a login challenge against one that already exists) is
|
||||
// handled here purely over HTTP, mirroring what a browser driving the same flow would do.
|
||||
// Keycloak's required-action flow follows Post/Redirect/Get: after accepting a form
|
||||
// submission it redirects back to its own login-actions endpoint (to be GET-followed)
|
||||
// rather than straight to our redirect_uri, so a Location header alone doesn't mean the
|
||||
// flow is finished - only a redirect that actually targets redirect_uri does.
|
||||
$redirectUriPrefix = OcisHelper::getServerUrl() . '/oidc-callback.html';
|
||||
$stepsTaken = [];
|
||||
for ($i = 0; $i < self::MAX_MFA_FLOW_STEPS; $i++) {
|
||||
$locationHeader = $response->getHeader('Location');
|
||||
if (!empty($locationHeader)) {
|
||||
$location = $locationHeader[0];
|
||||
if (\str_starts_with($location, $redirectUriPrefix)) {
|
||||
return self::extractCodeFromLocationHeader($location);
|
||||
}
|
||||
$stepsTaken[] = 'redirect: ' . $location;
|
||||
$cookie = $response->getHeader('Set-Cookie')[0] ?? $cookie;
|
||||
$response = HttpRequestHelper::get($location, null, null, [ 'Cookie' => $cookie ]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$html = $response->getBody()->getContents();
|
||||
// Keycloak may rotate the session cookie at every step of the flow
|
||||
$cookie = $response->getHeader('Set-Cookie')[0] ?? $cookie;
|
||||
|
||||
if (\preg_match('/id="kc-totp-settings-form"/i', $html)) {
|
||||
$stepsTaken[] = 'kc-totp-settings-form';
|
||||
[$formUrl, $fields] = self::parseForm($html, 'kc-totp-settings-form');
|
||||
$rawSecret = $fields['totpSecret'] ?? null;
|
||||
if ($rawSecret === null) {
|
||||
throw new Exception('Could not find the "totpSecret" hidden field on the TOTP setup form.');
|
||||
}
|
||||
$knownTotpSecret = Base32::encodeUnpadded($rawSecret);
|
||||
$fields['totp'] = TOTP::createFromSecret($knownTotpSecret)->now();
|
||||
$fields['userLabel'] = 'test';
|
||||
} else {
|
||||
throw new Exception(
|
||||
'Unexpected response after username/password submission - no redirect, and '
|
||||
. 'neither a TOTP setup nor a TOTP login form was found. Status: '
|
||||
. $response->getStatusCode() . ', body: ' . $html,
|
||||
);
|
||||
}
|
||||
|
||||
$response = HttpRequestHelper::post($formUrl, null, null, [ 'Cookie' => $cookie ], $fields);
|
||||
}
|
||||
throw new Exception(
|
||||
'Too many MFA steps without reaching a redirect to redirect_uri. Steps taken: '
|
||||
. \implode(' -> ', $stepsTaken) . '. Last response status: ' . $response->getStatusCode()
|
||||
. ', body: ' . $response->getBody()->getContents(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the named form out of the given HTML, returning its action url and every field it
|
||||
* carries (name/value pairs from every <input>/<button>, including hidden ones such as
|
||||
* "credentialId" or "totpSecret") - a real browser submission sends all of them, and
|
||||
* Keycloak's authenticators can silently re-render the same form (200, no redirect) if a
|
||||
* required hidden field is missing from the submission.
|
||||
*
|
||||
* @param string $html
|
||||
* @param string $formId
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
private static function parseForm(string $html, string $formId): array {
|
||||
// Capture the opening tag's attributes as one group so "id" and "action" can be pulled
|
||||
// out independent of which order Keycloak's template happens to render them in.
|
||||
if (!preg_match(
|
||||
'/<form\b([^>]*\bid="' . preg_quote($formId, '/') . '"[^>]*)>(.*?)<\/form>/is',
|
||||
$html,
|
||||
$formMatch,
|
||||
)
|
||||
) {
|
||||
throw new Exception("Could not find the \"$formId\" form in the HTML response body.");
|
||||
}
|
||||
$openingTagAttrs = $formMatch[1];
|
||||
$formBody = $formMatch[2];
|
||||
|
||||
if (!preg_match('/\baction="([^"]+)"/i', $openingTagAttrs, $actionMatch)) {
|
||||
throw new Exception("No action url found on the \"$formId\" form.");
|
||||
}
|
||||
$formUrl = \html_entity_decode($actionMatch[1]);
|
||||
|
||||
$fields = [];
|
||||
if (preg_match_all('/<(?:input|button)\b[^>]*>/i', $formBody, $fieldMatches)) {
|
||||
foreach ($fieldMatches[0] as $fieldTag) {
|
||||
if (!preg_match('/\bname="([^"]+)"/i', $fieldTag, $nameMatch)) {
|
||||
continue;
|
||||
}
|
||||
$value = '';
|
||||
if (preg_match('/\bvalue="([^"]*)"/i', $fieldTag, $valueMatch)) {
|
||||
$value = \html_entity_decode($valueMatch[1]);
|
||||
}
|
||||
$fields[$nameMatch[1]] = $value;
|
||||
}
|
||||
}
|
||||
return [$formUrl, $fields];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $location
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
private static function extractCodeFromLocationHeader(string $location): string {
|
||||
$queryString = parse_url($location, PHP_URL_QUERY);
|
||||
parse_str((string)$queryString, $urlParams);
|
||||
if (!isset($urlParams['code'])) {
|
||||
throw new Exception("No 'code' parameter found in redirect location: $location");
|
||||
}
|
||||
return $urlParams['code'];
|
||||
}
|
||||
|
||||
@@ -429,13 +559,18 @@ class KeycloakHelper {
|
||||
|
||||
/**
|
||||
* @param array $user
|
||||
* @param string|null $acrValues
|
||||
*
|
||||
* @return array
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function setAccessTokenForKeycloakOcisUser(array $user): array {
|
||||
[$authorizationUrl, $cookie] = self::getAuthorizationEndPoint();
|
||||
public static function setAccessTokenForKeycloakOcisUser(
|
||||
array $user,
|
||||
?string $acrValues = null,
|
||||
): array {
|
||||
[$authorizationUrl, $cookie] = self::getAuthorizationEndPoint($acrValues);
|
||||
$authorizationCode = self::getCode($user, $authorizationUrl, $cookie);
|
||||
$tokenResponse = self::getToken($authorizationCode);
|
||||
return json_decode($tokenResponse->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Prajwol Amatya <prajwol@jankaritech.com>
|
||||
* @copyright Copyright (c) 2022 Prajwol Amatya prajwol@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace TestHelpers;
|
||||
|
||||
require __DIR__ . '/../../../vendor-php/autoload.php';
|
||||
use Exception;
|
||||
use Playwright\Playwright;
|
||||
use Zxing\QrReader;
|
||||
use OTPHP\TOTP;
|
||||
|
||||
/**
|
||||
* A helper class for setting up user and store user access token using web UI
|
||||
*/
|
||||
class WebUIHelper {
|
||||
private static int $defaultTimeout = 5000;
|
||||
private static string $keycloakHeader = '#kc-header';
|
||||
private static string $usernameInput = '#username';
|
||||
private static string $passwordInput = '#password';
|
||||
private static string $loginButton = '#kc-login';
|
||||
private static string $filesView = '#files-view';
|
||||
private static string $modeSwitchButton = '#oc-topbar-mode-switch-btn';
|
||||
private static string $vaultModeSelector
|
||||
= "//button[contains(@class, 'oc-topbar-mode-switch-option')][.//span[text()='Vault']]";
|
||||
private static string $qrCode = '#kc-totp-secret-qr-code';
|
||||
private static string $totpInput = '#totp';
|
||||
private static string $userLabel = '#userLabel';
|
||||
private static string $saveTotpButton = '#saveTOTPBtn';
|
||||
|
||||
/**
|
||||
* @param string $ocisUrl
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function setUpUser(string $ocisUrl, string $username, string $password): array {
|
||||
$context = Playwright::chromium(
|
||||
[
|
||||
'headless' => true,
|
||||
'args' => ['--ignore-certificate-errors', '--no-sandbox'],
|
||||
],
|
||||
);
|
||||
try {
|
||||
$page = $context->newPage();
|
||||
$page->goto($ocisUrl, ['waitUntil' => 'networkidle']);
|
||||
$page->waitForSelector(self::$keycloakHeader, ['timeout' => self::$defaultTimeout]);
|
||||
$page->locator(self::$usernameInput)->fill($username);
|
||||
$page->locator(self::$passwordInput)->fill($password);
|
||||
$page->locator(self::$loginButton)->click();
|
||||
$page->waitForSelector(self::$filesView, ['timeout' => self::$defaultTimeout]);
|
||||
|
||||
// change to vault mode
|
||||
$page->locator(self::$modeSwitchButton)->click();
|
||||
$page->locator(self::$vaultModeSelector)->click();
|
||||
$page->waitForSelector(self::$qrCode, ['timeout' => self::$defaultTimeout]);
|
||||
|
||||
// Wait until the QR image's src is populated with actual data
|
||||
$page->waitForFunction(
|
||||
"(sel) => {\n" .
|
||||
" const img = document.querySelector(sel);\n" .
|
||||
" return img && img.src && img.src.startsWith('data:image');\n" .
|
||||
"}",
|
||||
self::$qrCode,
|
||||
['timeout' => self::$defaultTimeout],
|
||||
);
|
||||
|
||||
// setup mfa - read QR image data directly from the DOM instead of
|
||||
// taking a screenshot, avoiding rendering/crop/timing flakiness
|
||||
$qrSrc = $page->locator(self::$qrCode)->getAttribute('src');
|
||||
if (empty($qrSrc)) {
|
||||
throw new Exception("QR code image element has no 'src' attribute");
|
||||
}
|
||||
|
||||
$otp = self::extractOtpFromQrDataUri($qrSrc);
|
||||
$page->locator(self::$totpInput)->fill((string)$otp);
|
||||
$page->locator(self::$userLabel)->fill('test');
|
||||
$page->locator(self::$saveTotpButton)->click();
|
||||
$page->waitForSelector(self::$filesView, ['timeout' => self::$defaultTimeout]);
|
||||
return $context->storageState();
|
||||
} catch (\Exception $e) {
|
||||
throw new Exception("Login failed for user '$username': " . $e->getMessage(), 0, $e);
|
||||
} finally {
|
||||
$context->close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a base64 PNG data URI (as found in the QR <img> src attribute),
|
||||
* writes it to a temp file, and extracts the current TOTP code from it.
|
||||
*
|
||||
* @param string $dataUri e.g. "data:image/png;base64,iVBORw0KG..."
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function extractOtpFromQrDataUri(string $dataUri): string {
|
||||
if (!preg_match('/^data:image\/(\w+);base64,\s*(.+)$/', $dataUri, $matches)) {
|
||||
throw new Exception("QR src is not a valid base64 data URI");
|
||||
}
|
||||
|
||||
$imageData = base64_decode($matches[2], true);
|
||||
if ($imageData === false) {
|
||||
throw new Exception("Failed to base64-decode QR image data");
|
||||
}
|
||||
|
||||
$tmpPath = tempnam(sys_get_temp_dir(), 'qr_');
|
||||
if ($tmpPath === false) {
|
||||
throw new Exception("Failed to create temp file for QR image data");
|
||||
}
|
||||
$pngPath = $tmpPath . '.png';
|
||||
if (!rename($tmpPath, $pngPath)) {
|
||||
unlink($tmpPath);
|
||||
throw new Exception("Failed to rename temp file to PNG path");
|
||||
}
|
||||
|
||||
try {
|
||||
if (file_put_contents($tmpPath, $imageData) === false) {
|
||||
throw new Exception("Failed to write QR image data to: " . $tmpPath);
|
||||
}
|
||||
return self::extractOtpFromQr($tmpPath);
|
||||
} finally {
|
||||
if (file_exists($pngPath)) {
|
||||
unlink($pngPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $imagePath
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function extractOtpFromQr(string $imagePath): string {
|
||||
$qrReader = new QrReader($imagePath);
|
||||
$qrData = $qrReader->text();
|
||||
|
||||
if (empty($qrData)) {
|
||||
throw new Exception("Could not decode QR code from image: " . $imagePath);
|
||||
}
|
||||
|
||||
$parsedUrl = parse_url($qrData);
|
||||
if (!isset($parsedUrl['query'])) {
|
||||
throw new Exception("QR code data does not contain a valid otpauth URL: " . $qrData);
|
||||
}
|
||||
|
||||
parse_str($parsedUrl['query'], $queryParams);
|
||||
$secret = $queryParams['secret'] ?? null;
|
||||
|
||||
if ($secret === null) {
|
||||
throw new Exception("No 'secret' parameter found in QR code URL: " . $qrData);
|
||||
}
|
||||
|
||||
$totp = TOTP::createFromSecret($secret);
|
||||
|
||||
return $totp->now();
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,6 @@ use TestHelpers\GraphHelper;
|
||||
use TestHelpers\KeycloakHelper;
|
||||
use Laminas\Ldap\Exception\LdapException;
|
||||
use Laminas\Ldap\Ldap;
|
||||
use TestHelpers\WebUIHelper;
|
||||
|
||||
/**
|
||||
* Functions for provisioning of users and groups
|
||||
@@ -49,6 +48,10 @@ trait Provisioning {
|
||||
private array $userTokens = [];
|
||||
private array $createdKeycloakUsers = [];
|
||||
private ?Ldap $idmLdap = null;
|
||||
// the acr_values requested at Keycloak's authorize endpoint in userHasLoggedInViaWebUI();
|
||||
// override via setAcrValuesToRequest() in scenarios that reconfigure OCIS_MFA_AUTH_LEVEL_NAMES
|
||||
// to something other than the "advanced" default (see VaultContext)
|
||||
private string $acrValuesToRequest = 'advanced';
|
||||
|
||||
/**
|
||||
* @param array $user
|
||||
@@ -727,46 +730,24 @@ trait Provisioning {
|
||||
"email" => "admin@example.org",
|
||||
"actualUsername" => "admin",
|
||||
];
|
||||
$state = WebUIHelper::setUpUser(
|
||||
$this->getBaseUrl(),
|
||||
$adminUser["actualUsername"],
|
||||
$adminUser["password"],
|
||||
);
|
||||
$tokenData = $this->extractOidcTokenDataFromStorageState($state);
|
||||
$tokenData = KeycloakHelper::setAccessTokenForKeycloakOcisUser($adminUser, $this->acrValuesToRequest);
|
||||
$this->setOcisUserToken($adminUser, $tokenData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up Keycloak user in oCIS
|
||||
* User is logged in via web UI and user access token is extracted
|
||||
*
|
||||
* @Given user :user has logged in via web UI
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $acrValues
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function userHasLoggedInViaWebUI(string $user): void {
|
||||
$createdUsers = $this->getCreatedKeycloakUsers();
|
||||
$userAttribute = $createdUsers[strtolower($user)];
|
||||
$state = WebUIHelper::setUpUser(
|
||||
$this->getBaseUrl(),
|
||||
$userAttribute["actualUsername"],
|
||||
$userAttribute["password"],
|
||||
);
|
||||
$stateData = $this->extractOidcTokenDataFromStorageState($state);
|
||||
$this->setOcisUserToken($userAttribute, $stateData);
|
||||
$response = $this->graphContext->adminHasRetrievedUserUsingTheGraphApi($user);
|
||||
$userAttribute['id'] = $this->getJsonDecodedResponse($response)['id'];
|
||||
$this->addUserToCreatedUsersList(
|
||||
$user,
|
||||
$userAttribute['password'],
|
||||
$userAttribute['displayName'],
|
||||
$userAttribute['email'],
|
||||
$userAttribute['id'],
|
||||
);
|
||||
public function setAcrValuesToRequest(string $acrValues): void {
|
||||
$this->acrValuesToRequest = $acrValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAcrValuesToRequest(): string {
|
||||
return $this->acrValuesToRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,6 +77,10 @@ class VaultContext implements Context {
|
||||
$response->getStatusCode(),
|
||||
"Failed to update Keycloak realm attribute $key. Response: " . $response->getBody()->getContents(),
|
||||
);
|
||||
// Decode the JSON map
|
||||
$acrLoaMap = \json_decode($value, true);
|
||||
$acrValue = array_keys($acrLoaMap, "2");
|
||||
$this->featureContext->setAcrValuesToRequest($acrValue[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,7 +140,6 @@ class VaultContext implements Context {
|
||||
$headers = [];
|
||||
$authUser = $user;
|
||||
if (KeycloakHelper::isTestingWithKeycloak()) {
|
||||
$this->authenticateKeycloakUserIfNeeded($user);
|
||||
$accessToken = $this->featureContext->getOcisUserToken($user)['token']['accessToken'];
|
||||
$headers['Authorization'] = 'Bearer ' . $accessToken;
|
||||
$authUser = null;
|
||||
@@ -162,13 +165,17 @@ class VaultContext implements Context {
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
* @throws Exception
|
||||
*/
|
||||
private function authenticateKeycloakUserIfNeeded(string $user): void {
|
||||
private function setUpKeycloakUserInOcis(string $user): void {
|
||||
if ($this->featureContext->getAttributeOfCreatedUser($user, 'id')) {
|
||||
return;
|
||||
}
|
||||
$userAttribute = $this->featureContext->getCreatedKeycloakUsers()[strtolower($user)];
|
||||
$tokenData = KeycloakHelper::setAccessTokenForKeycloakOcisUser($userAttribute);
|
||||
$tokenData = KeycloakHelper::setAccessTokenForKeycloakOcisUser(
|
||||
$userAttribute,
|
||||
$this->featureContext->getAcrValuesToRequest(),
|
||||
);
|
||||
$this->featureContext->setOcisUserToken($userAttribute, $tokenData);
|
||||
|
||||
$response = HttpRequestHelper::get(
|
||||
@@ -188,24 +195,19 @@ class VaultContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* Provisions the user's ocis account without touching the vault mode UI. Use this instead of
|
||||
* "user :user has logged in via web UI" for users whose role does not grant the vault mode
|
||||
* permission, e.g. User Light: they have no mode switcher to click, so the web UI login times
|
||||
* out, but their ocis id is still needed to e.g. resolve them as a sharee.
|
||||
* Sets up a Keycloak user in oCIS
|
||||
*
|
||||
* @Given user :user has logged in without vault mode
|
||||
* @Given user :user has been set up in oCIS
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function userHasLoggedInWithoutVaultMode(string $user): void {
|
||||
if (!KeycloakHelper::isTestingWithKeycloak()) {
|
||||
return;
|
||||
}
|
||||
$this->authenticateKeycloakUserIfNeeded($user);
|
||||
public function userHasBeenSetUpInOcis(string $user): void {
|
||||
$this->setUpKeycloakUserInOcis($user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,7 +12,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user can create folders and files in personal space in vault
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
When user "Alice" creates a folder "vaultFolder" in space "Personal" in vault using the WebDav Api
|
||||
Then the HTTP status code should be "201"
|
||||
When user "Alice" uploads a file inside space "Personal" with content "some content" to "vaultFile.txt" in vault using the WebDAV API
|
||||
@@ -23,7 +23,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user can create folders and files in project space in vault
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a space "vault-space" in vault with the default quota using the Graph API
|
||||
When user "Alice" creates a folder "vaultFolder" in space "vault-space" in vault using the WebDav Api
|
||||
Then the HTTP status code should be "201"
|
||||
@@ -35,7 +35,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: resources in drive and vault are isolated
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a folder "driveFolder" in space "Personal"
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "driveFile.txt"
|
||||
And user "Alice" has created a folder "vaultFolder" in space "Personal" in vault
|
||||
@@ -64,7 +64,7 @@ Feature: vault
|
||||
# globally" here.
|
||||
And the config "OCIS_MFA_AUTH_LEVEL_NAMES" has been set to "testing" for "proxy" service
|
||||
And the config "OCIS_MFA_AUTH_LEVEL_NAMES" has been set to "testing" for "frontend" service
|
||||
And user "Alice" has logged in via web UI
|
||||
And user "Alice" has been set up in oCIS
|
||||
When user "Alice" uploads a file inside space "Personal" with content "some content" to "vaultFile.txt" in vault using the WebDAV API
|
||||
Then the HTTP status code should be "201"
|
||||
And user "Alice" should have a JWT token with an ACR value "testing"
|
||||
@@ -72,7 +72,7 @@ Feature: vault
|
||||
|
||||
Scenario: check capabilities endpoint for vault
|
||||
Given using OCS API version "2"
|
||||
And user "Alice" has logged in via web UI
|
||||
And user "Alice" has been set up in oCIS
|
||||
When user "Alice" retrieves the vault mode capabilities using the capabilities API
|
||||
Then the OCS status code should be "200"
|
||||
And the HTTP status code should be "200"
|
||||
@@ -191,7 +191,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user copies folder from drive to vault
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a folder "driveFolder" in space "Personal"
|
||||
When user "Alice" copies folder "driveFolder" from space "Personal" to "driveFolder" inside space "Personal" in vault using the WebDAV API
|
||||
Then the HTTP status code should be "201"
|
||||
@@ -202,7 +202,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user copies file from drive to vault
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "testfile.txt"
|
||||
When user "Alice" copies file "testfile.txt" from space "Personal" to "testfile.txt" inside space "Personal" in vault using the WebDAV API
|
||||
Then the HTTP status code should be "201"
|
||||
@@ -212,7 +212,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user tries to copy folder from vault to drive
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a folder "vaultFolder" in space "Personal" in vault
|
||||
When user "Alice" copies folder "vaultFolder" from space "Personal" in vault to "vaultFolder" inside space "Personal" using the WebDAV API
|
||||
Then the HTTP status code should be "409"
|
||||
@@ -223,7 +223,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user tries to copy file from vault to drive
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "testfile.txt" in vault
|
||||
When user "Alice" copies file "testfile.txt" from space "Personal" in vault to "testfile.txt" inside space "Personal" using the WebDAV API
|
||||
Then the HTTP status code should be "409"
|
||||
@@ -234,7 +234,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user copies sub-folder from drive to vault
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a folder "driveFolder" in space "Personal"
|
||||
And user "Alice" has created a folder "driveFolder/subFolder" in space "Personal"
|
||||
When user "Alice" copies folder "driveFolder/subFolder" from space "Personal" to "subFolder" inside space "Personal" in vault using the WebDAV API
|
||||
@@ -246,7 +246,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user copies file inside folder from drive to vault
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a folder "driveFolder" in space "Personal"
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "driveFolder/testfile.txt"
|
||||
When user "Alice" copies file "driveFolder/testfile.txt" from space "Personal" to "testfile.txt" inside space "Personal" in vault using the WebDAV API
|
||||
@@ -257,7 +257,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user copies sub-folder from drive to a folder in vault
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a folder "driveFolder" in space "Personal"
|
||||
And user "Alice" has created a folder "driveFolder/subFolder" in space "Personal"
|
||||
And user "Alice" has created a folder "vaultFolder" in space "Personal" in vault
|
||||
@@ -270,7 +270,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user copies file inside folder from drive to a folder in vault
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a folder "driveFolder" in space "Personal"
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "driveFolder/testfile.txt"
|
||||
And user "Alice" has created a folder "vaultFolder" in space "Personal" in vault
|
||||
@@ -282,7 +282,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user tries to create a public link of a folder inside vault
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a folder "vaultFolder" in space "Personal" in vault
|
||||
When user "Alice" creates the following resource link share using the Graph API:
|
||||
| resource | vaultFolder |
|
||||
@@ -321,7 +321,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user tries to create a public link of a file inside vault
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "testfile.txt" in vault
|
||||
When user "Alice" creates the following resource link share using the Graph API:
|
||||
| resource | testfile.txt |
|
||||
@@ -360,7 +360,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: user tries to create a public link of a space root inside vault
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a space "vault-space" in vault with the default quota using the Graph API
|
||||
When user "Alice" tries to create the following space link share using permissions endpoint of the Graph API:
|
||||
| space | vault-space |
|
||||
@@ -398,10 +398,10 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario Outline: send share invitation for project space in vault to user with different roles (permissions endpoint)
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Brian" has been set up in oCIS
|
||||
And user "Alice" has created a space "new-space" in vault with the default quota using the Graph API
|
||||
When user "Alice" sends the following space share invitation using permissions endpoint of the Graph API:
|
||||
| space | new-space |
|
||||
@@ -476,10 +476,10 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario Outline: send share invitation for disabled project space in vault to user with different roles (permissions endpoint)
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Brian" has been set up in oCIS
|
||||
And user "Alice" has created a space "new-space" in vault with the default quota using the Graph API
|
||||
And user "Admin" has disabled a space "new-space" in vault
|
||||
When user "Alice" sends the following space share invitation using permissions endpoint of the Graph API:
|
||||
@@ -524,10 +524,10 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario Outline: send share invitation for deleted project space in vault to user with different roles (permissions endpoint)
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Brian" has been set up in oCIS
|
||||
And user "Alice" has created a space "new-space" in vault with the default quota using the Graph API
|
||||
And user "Admin" has disabled a space "new-space" in vault
|
||||
And user "Admin" has deleted a space "new-space" in vault
|
||||
@@ -572,10 +572,10 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario Outline: try to send share invitation for personal space in vault to user with different roles (permissions endpoint)
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Brian" has been set up in oCIS
|
||||
When user "Alice" sends the following space share invitation using permissions endpoint of the Graph API:
|
||||
| space | Personal |
|
||||
| sharee | Brian |
|
||||
@@ -619,10 +619,10 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario Outline: try to share Shares space in vault with a user (permissions endpoint)
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Brian" has been set up in oCIS
|
||||
When user "Alice" sends the following space share invitation using permissions endpoint of the Graph API:
|
||||
| space | Shares |
|
||||
| sharee | Brian |
|
||||
@@ -666,10 +666,10 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario Outline: invite user to a project space in vault with different roles using root endpoint
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Brian" has been set up in oCIS
|
||||
And user "Alice" has created a space "new-space" in vault with the default quota using the Graph API
|
||||
When user "Alice" sends the following space share invitation using root endpoint of the Graph API:
|
||||
| space | new-space |
|
||||
@@ -745,10 +745,10 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario Outline: try to invite user to personal drive in vault with different roles using root endpoint
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Brian" has been set up in oCIS
|
||||
When user "Alice" tries to send the following space share invitation using root endpoint of the Graph API:
|
||||
| space | Personal |
|
||||
| sharee | Brian |
|
||||
@@ -792,10 +792,10 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario Outline: try to invite user to Shares drive in vault with different roles using root endpoint
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Brian" has been set up in oCIS
|
||||
When user "Alice" tries to send the following space share invitation using root endpoint of the Graph API:
|
||||
| space | Shares |
|
||||
| sharee | Brian |
|
||||
@@ -839,7 +839,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: search results for resources in Personal space should be isolated between vault and drive
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a folder "testDriveFolder" in space "Personal"
|
||||
And user "Alice" has created a folder "testVaultFolder" in space "Personal" in vault
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "testDriveFile.txt"
|
||||
@@ -859,7 +859,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: search results for resources inside folder with same name should be isolated between vault and drive
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a folder "newFolder" in space "Personal"
|
||||
And user "Alice" has created a folder "newFolder" in space "Personal" in vault
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "newFolder/testDriveFile.txt"
|
||||
@@ -877,7 +877,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: search result for resources inside project spaces with same name should be isolated between vault and drive
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a space "new-space" with the default quota using the Graph API
|
||||
And user "Alice" has created a space "new-space" in vault with the default quota using the Graph API
|
||||
And user "Alice" has created a folder "testDriveFolder" in space "new-space"
|
||||
@@ -899,7 +899,7 @@ Feature: vault
|
||||
|
||||
@tikaServiceNeeded
|
||||
Scenario: search result by content of file should be isolated between vault and drive
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "content of file in drive" to "testDriveFile.txt"
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "content of file in vault" to "testVaultFile.txt" in vault
|
||||
When user "Alice" searches for "Content:content" in vault using the WebDAV API
|
||||
@@ -915,7 +915,7 @@ Feature: vault
|
||||
|
||||
@tikaServiceNeeded
|
||||
Scenario: search result by content of file inside project space should be isolated between vault and drive
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a space "new-space" with the default quota using the Graph API
|
||||
And user "Alice" has created a space "new-space" in vault with the default quota using the Graph API
|
||||
And user "Alice" has uploaded a file inside space "new-space" with content "content of file in drive" to "testDriveFile.txt"
|
||||
@@ -933,7 +933,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: search results by resource tags should be isolated between vault and drive
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a folder "driveFolder" in space "Personal"
|
||||
And user "Alice" has created a folder "vaultFolder" in space "Personal" in vault
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "testDriveFile.txt"
|
||||
@@ -965,7 +965,7 @@ Feature: vault
|
||||
|
||||
|
||||
Scenario: search results by resource tags inside project space should be isolated between vault and drive
|
||||
Given user "Alice" has logged in via web UI
|
||||
Given user "Alice" has been set up in oCIS
|
||||
And user "Alice" has created a space "new-space" with the default quota using the Graph API
|
||||
And user "Alice" has created a space "new-space" in vault with the default quota using the Graph API
|
||||
And user "Alice" has created a folder "driveFolder" in space "new-space"
|
||||
@@ -1001,8 +1001,8 @@ Feature: vault
|
||||
Scenario Outline: folder share received from vault and drive personal space should be isolated
|
||||
Given user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Alice" has logged in via web UI
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been set up in oCIS
|
||||
And user "Alice" has created a folder "driveFolder" in space "Personal"
|
||||
And user "Alice" has created a folder "vaultFolder" in space "Personal" in vault
|
||||
And user "Alice" has sent the following resource share invitation:
|
||||
@@ -1036,8 +1036,8 @@ Feature: vault
|
||||
Scenario Outline: file share received from vault and drive personal space should be isolated
|
||||
Given user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Alice" has logged in via web UI
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been set up in oCIS
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "driveFile.txt"
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "vaultFile.txt" in vault
|
||||
And user "Alice" has sent the following resource share invitation:
|
||||
@@ -1070,8 +1070,8 @@ Feature: vault
|
||||
Scenario Outline: folder share received from vault and drive project space should be isolated
|
||||
Given user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Alice" has logged in via web UI
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been set up in oCIS
|
||||
And user "Alice" has created a space "new-space" with the default quota using the Graph API
|
||||
And user "Alice" has created a space "new-space" in vault with the default quota using the Graph API
|
||||
And user "Alice" has created a folder "driveFolder" in space "new-space"
|
||||
@@ -1107,8 +1107,8 @@ Feature: vault
|
||||
Scenario Outline: folder share received from vault and drive project space should be isolated
|
||||
Given user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Alice" has logged in via web UI
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been set up in oCIS
|
||||
And user "Alice" has created a space "new-space" with the default quota using the Graph API
|
||||
And user "Alice" has created a space "new-space" in vault with the default quota using the Graph API
|
||||
And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "driveFile.txt"
|
||||
@@ -1143,8 +1143,8 @@ Feature: vault
|
||||
Scenario Outline: try to send share invitation for a resource in vault to a user without the vault mode permission
|
||||
Given user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "User Light" to user "Brian" using the Graph API
|
||||
And user "Alice" has logged in via web UI
|
||||
And user "Brian" has logged in without vault mode
|
||||
And user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been set up in oCIS
|
||||
And user "Alice" has created a folder "vaultFolder" in space "Personal" in vault
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "vaultFile.txt" in vault
|
||||
When user "Alice" sends the following resource share invitation using the Graph API:
|
||||
@@ -1196,9 +1196,9 @@ Feature: vault
|
||||
| groupname |
|
||||
| vault-group |
|
||||
And user "Brian" has been created with default attributes
|
||||
And user "Brian" has logged in without vault mode
|
||||
And user "Brian" has been set up in oCIS
|
||||
And user "Brian" has been added to group "vault-group"
|
||||
And user "Alice" has logged in via web UI
|
||||
And user "Alice" has been set up in oCIS
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "vaultFile.txt" in vault
|
||||
When user "Alice" sends the following resource share invitation using the Graph API:
|
||||
| resource | vaultFile.txt |
|
||||
@@ -1235,8 +1235,8 @@ Feature: vault
|
||||
Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
|
||||
And user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "User Light" to user "Brian" using the Graph API
|
||||
And user "Alice" has logged in via web UI
|
||||
And user "Brian" has logged in without vault mode
|
||||
And user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been set up in oCIS
|
||||
And user "Alice" has created a space "vault-space" in vault with the default quota using the Graph API
|
||||
When user "Alice" sends the following space share invitation using permissions endpoint of the Graph API:
|
||||
| space | vault-space |
|
||||
@@ -1276,8 +1276,8 @@ Feature: vault
|
||||
Scenario Outline: send share invitation for a resource in vault to a user with the vault mode permission
|
||||
Given user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "Space Admin" to user "Brian" using the Graph API
|
||||
And user "Alice" has logged in via web UI
|
||||
And user "Brian" has logged in via web UI
|
||||
And user "Alice" has been set up in oCIS
|
||||
And user "Brian" has been set up in oCIS
|
||||
And user "Alice" has created a folder "vaultFolder" in space "Personal" in vault
|
||||
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "vaultFile.txt" in vault
|
||||
When user "Alice" sends the following resource share invitation using the Graph API:
|
||||
@@ -1300,6 +1300,7 @@ Feature: vault
|
||||
|
||||
Scenario Outline: users with role Admin or Space Admin should have access to vault
|
||||
Given the administrator has assigned the role "<user-role>" to user "Alice" using the Graph API
|
||||
And user "Alice" has been set up in oCIS
|
||||
When user "Alice" gets the permissions list using the settings API
|
||||
Then the HTTP status code should be "201"
|
||||
And the JSON data of the response should match
|
||||
@@ -1329,6 +1330,7 @@ Feature: vault
|
||||
Scenario Outline: users with role User or User Light should not have access to vault
|
||||
Given user "Brian" has been created with default attributes
|
||||
And the administrator has assigned the role "<user-role>" to user "Brian" using the Graph API
|
||||
And user "Brian" has been set up in oCIS
|
||||
When user "Brian" gets the permissions list using the settings API
|
||||
Then the HTTP status code should be "201"
|
||||
And the JSON data of the response should match
|
||||
|
||||
@@ -510,12 +510,6 @@ def main() -> int:
|
||||
cfg["extraServerEnvironment"]["OCM_OCM_PROVIDER_AUTHORIZER_PROVIDERS_FILE"] = providers_tmp.name
|
||||
|
||||
if cfg["keycloakNeeded"]:
|
||||
# Install Playwright runtime and browsers (required for web UI tests)
|
||||
print("Installing Playwright...")
|
||||
run([str(repo_root / "vendor-php/bin/playwright-install")])
|
||||
run([str(repo_root / "vendor-php/bin/playwright-install"), "--browsers"])
|
||||
print("Playwright ready.")
|
||||
|
||||
# Generate TLS certs for keycloak
|
||||
print("Generating keycloak certs...")
|
||||
keycloak_certs_dir = repo_root / "keycloak-certs"
|
||||
|
||||
Reference in new issue
Block a user