|
@@ 425-437 (lines=13) @@
|
| 422 |
|
// legacy way, expecting that this won't be used together with "create-only" shares |
| 423 |
|
$publicUpload = $this->request->getParam('publicUpload', null); |
| 424 |
|
// a few permission checks |
| 425 |
|
if ($publicUpload === 'true' || $permissions === \OCP\Constants::PERMISSION_CREATE) { |
| 426 |
|
// Check if public upload is allowed |
| 427 |
|
if (!$this->shareManager->shareApiLinkAllowPublicUpload()) { |
| 428 |
|
$share->getNode()->unlock(ILockingProvider::LOCK_SHARED); |
| 429 |
|
return new Result(null, 403, $this->l->t('Public upload disabled by the administrator')); |
| 430 |
|
} |
| 431 |
|
|
| 432 |
|
// Public upload can only be set for folders |
| 433 |
|
if ($path instanceof \OCP\Files\File) { |
| 434 |
|
$share->getNode()->unlock(ILockingProvider::LOCK_SHARED); |
| 435 |
|
return new Result(null, 404, $this->l->t('Public upload is only possible for publicly shared folders')); |
| 436 |
|
} |
| 437 |
|
} |
| 438 |
|
|
| 439 |
|
// convert to permissions |
| 440 |
|
if ($publicUpload === 'true') { |
|
@@ 765-777 (lines=13) @@
|
| 762 |
|
} |
| 763 |
|
|
| 764 |
|
// create-only (upload-only) |
| 765 |
|
if ( |
| 766 |
|
$newPermissions === \OCP\Constants::PERMISSION_CREATE |
| 767 |
|
) { |
| 768 |
|
if (!$this->shareManager->shareApiLinkAllowPublicUpload()) { |
| 769 |
|
$share->getNode()->unlock(ILockingProvider::LOCK_SHARED); |
| 770 |
|
return new Result(null, 403, $this->l->t('Public upload disabled by the administrator')); |
| 771 |
|
} |
| 772 |
|
|
| 773 |
|
if (!($share->getNode() instanceof \OCP\Files\Folder)) { |
| 774 |
|
$share->getNode()->unlock(ILockingProvider::LOCK_SHARED); |
| 775 |
|
return new Result(null, 400, $this->l->t('Public upload is only possible for publicly shared folders')); |
| 776 |
|
} |
| 777 |
|
} |
| 778 |
|
|
| 779 |
|
// set name only if passed as parameter, empty string is allowed |
| 780 |
|
if ($name !== null) { |