Skip to content

Commit

Permalink
Adjust code and related acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Aug 12, 2022
1 parent 821d51e commit 5e9e12e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions apps/files_sharing/lib/Controller/Share20OcsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ public function createShare() {

if ($fullShare->getExpirationDate() !== null && $paramExpireDate !== '') {
if ($this->parseDate($paramExpireDate) > $fullShare->getExpirationDate()) {
throw new Exception('Expiration date exceeds the parent share\'s expiration date');
return new Result(null, 403, 'Expiration date exceeds the parent share\'s expiration date');
}
}
}
Expand Down Expand Up @@ -1005,7 +1005,7 @@ public function updateShare($id) {

if ($fullShare->getExpirationDate() !== null && $paramExpireDate !== '') {
if ($this->parseDate($paramExpireDate) > $fullShare->getExpirationDate()) {
throw new Exception('Expiration date exceeds the parent share\'s expiration date');
return new Result(null, 403, 'Expiration date exceeds the parent share\'s expiration date');
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,15 +405,15 @@ Feature: resharing a resource with an expiration date
| expireDate | +40 days |
#The action of extending the expiration date while resharing should be forbidden
Then the HTTP status code should be "<http_status_code>"
And the OCS status code should be "<ocs_status_code>"
And the OCS status code should be "403"
And the information of the last share of user "Alice" should include
| expiration | +20 days |
Examples:
| ocs_api_version | default-expire-date | ocs_status_code | http_status_code |
| 1 | yes | 996 | 200 |
| 2 | yes | 500 | 500 |
| 1 | no | 996 | 200 |
| 2 | no | 500 | 500 |
| ocs_api_version | default-expire-date | http_status_code |
| 1 | yes | 200 |
| 2 | yes | 403 |
| 1 | no | 200 |
| 2 | no | 403 |

@skipOnOcV10.8 @skipOnOcV10.9 @skipOnOcV10.10
Scenario Outline: reshare cannot extend the received expiry date past the default when the default is enforced
Expand All @@ -436,10 +436,10 @@ Feature: resharing a resource with an expiration date
| shareWith | Carol |
| expireDate | +40 days |
Then the HTTP status code should be "<http_status_code>"
And the OCS status code should be "<ocs_status_code>"
And the OCS status code should be "403"
And the information of the last share of user "Alice" should include
| expiration | +20 days |
Examples:
| ocs_api_version | default-expire-date | ocs_status_code | http_status_code |
| 1 | yes | 996 | 200 |
| 2 | yes | 500 | 500 |
| ocs_api_version | http_status_code |
| 1 | 200 |
| 2 | 403 |

0 comments on commit 5e9e12e

Please sign in to comment.