Select Available role only while sharing space

This commit is contained in:
sagargurung1001@gmail.com
2022-08-11 14:28:54 +05:45
parent 18996ea42a
commit c41cf352cd
3 changed files with 7 additions and 5 deletions
@@ -1989,6 +1989,10 @@ class SpacesContext implements Context {
string $role
): void {
$space = $this->getSpaceByName($user, $spaceName);
$availableRoleToAssignToShareSpace = ['manager', 'editor', 'viewer'];
if (!\in_array(\strtolower($role), $availableRoleToAssignToShareSpace)) {
throw new Error("The Selected " . $role . " Cannot be Found");
}
$body = [
"space_ref" => $space['id'],
"shareType" => 7,
@@ -1997,7 +2001,6 @@ class SpacesContext implements Context {
];
$fullUrl = $this->baseUrl . $this->ocsApiUrl;
$this->featureContext->setResponse(
$this->sendPostRequestToUrl(
$fullUrl,
@@ -2111,7 +2114,6 @@ class SpacesContext implements Context {
string $role
): void {
$this->sendShareSpaceRequest($user, $spaceName, $userRecipient, $role);
$expectedHTTPStatus = "200";
$this->featureContext->theHTTPStatusCodeShouldBe(
$expectedHTTPStatus,