Skip to content

Commit

Permalink
Set up remote server share with permissions using API
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Jun 6, 2019
1 parent af104cb commit 80922de
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 7 deletions.
50 changes: 48 additions & 2 deletions tests/acceptance/features/bootstrap/FederationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@ class FederationContext implements Context {
*/
public function userFromServerSharesWithUserFromServerUsingTheSharingAPI(
$sharerUser, $sharerServer, $sharerPath, $shareeUser, $shareeServer
) {
$this->userFromServerSharesWithUserFromServerUsingTheSharingAPIWithPermissions(
$sharerUser, $sharerServer, $sharerPath, $shareeUser, $shareeServer
);
}

/**
* @When /^user "([^"]*)" from server "(LOCAL|REMOTE)" shares "([^"]*)" with user "([^"]*)" from server "(LOCAL|REMOTE)" using the sharing API with permissions (.*)$/
*
* @param string $sharerUser
* @param string $sharerServer "LOCAL" or "REMOTE"
* @param string $sharerPath
* @param string $shareeUser
* @param string $shareeServer "LOCAL" or "REMOTE"
* @param int $permissions
*
* @return void
*/
public function userFromServerSharesWithUserFromServerUsingTheSharingAPIWithPermissions(
$sharerUser, $sharerServer, $sharerPath, $shareeUser, $shareeServer, $permissions = null
) {
if ($shareeServer == "REMOTE") {
$shareWith
Expand All @@ -68,11 +88,11 @@ public function userFromServerSharesWithUserFromServerUsingTheSharingAPI(
}
$previous = $this->featureContext->usingServer($sharerServer);
$this->featureContext->createShare(
$sharerUser, $sharerPath, 6, $shareWith, null, null, null
$sharerUser, $sharerPath, 6, $shareWith, null, null, $permissions
);
$this->featureContext->usingServer($previous);
}

/**
* @Given /^user "([^"]*)" from server "(LOCAL|REMOTE)" has shared "([^"]*)" with user "([^"]*)" from server "(LOCAL|REMOTE)"$/
*
Expand All @@ -98,6 +118,32 @@ public function userFromServerHasSharedWithUserFromServer(
);
}

/**
* @Given /^user "([^"]*)" from server "(LOCAL|REMOTE)" has shared "([^"]*)" with user "([^"]*)" from server "(LOCAL|REMOTE)" with permissions (.*)$/
*
* @param string $sharerUser
* @param string $sharerServer "LOCAL" or "REMOTE"
* @param string $sharerPath
* @param string $shareeUser
* @param string $shareeServer "LOCAL" or "REMOTE"
* @param int $permissions
*
* @return void
*/
public function userFromServerHasSharedWithUserFromServerWithPermissions(
$sharerUser, $sharerServer, $sharerPath, $shareeUser, $shareeServer, $permissions = null
) {
$this->userFromServerSharesWithUserFromServerUsingTheSharingAPIWithPermissions(
$sharerUser, $sharerServer, $sharerPath, $shareeUser, $shareeServer, $permissions
);
$this->ocsContext->assertOCSResponseIndicatesSuccess(
'Could not share file/folder! message: "' .
$this->ocsContext->getOCSResponseStatusMessage(
$this->featureContext->getResponse()
) . '"'
);
}

/**
* @When /^user "([^"]*)" from server "(LOCAL|REMOTE)" accepts the last pending share using the sharing API$/
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,9 @@ Feature: Federation Sharing - sharing with users on other cloud storages

@skipOnMICROSOFTEDGE
Scenario: share a folder with an remote user and prohibit deleting - remote server shares - local server receives
When user "user1" re-logs in to "%remote_server%" using the webUI
And the user shares folder "simple-folder" with remote user "user1@%local_server_without_scheme%" using the webUI
And the user sets the sharing permissions of "user1@%local_server_without_scheme% (federated)" for "simple-folder" using the webUI to
| delete | no |
And user "user1" re-logs in to "%local_server%" using the webUI
# permissions read+update+create = 7 (no delete, no (re)share permission)
Given user "user1" from server "REMOTE" has shared "simple-folder" with user "user1" from server "LOCAL" with permissions 7
When the user browses to the files page
And the user accepts the offered remote shares using the webUI
And the user opens folder "simple-folder (2)" using the webUI
Then it should not be possible to delete file "lorem.txt" using the webUI
Expand Down

0 comments on commit 80922de

Please sign in to comment.