Merge pull request #21032 from nextcloud/backport/20846/stable19
[stable19] Link permissions
This commit is contained in:
commit
e003fcd806
|
@ -216,15 +216,6 @@ class ShareAPIController extends OCSController {
|
||||||
$result['expiration'] = $expiration->format('Y-m-d 00:00:00');
|
$result['expiration'] = $expiration->format('Y-m-d 00:00:00');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: It might make sense to have a dedicated setting to allow/deny converting link shares into federated ones
|
|
||||||
// For link shares, we need to have the PERMISSION_SHARE if federated is enabled
|
|
||||||
if ($this->shareManager->outgoingServer2ServerSharesAllowed()) {
|
|
||||||
if ($share->getShareType() === IShare::TYPE_LINK
|
|
||||||
|| $share->getShareType() === IShare::TYPE_EMAIL) {
|
|
||||||
$result['permissions'] |= Constants::PERMISSION_SHARE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($share->getShareType() === IShare::TYPE_USER) {
|
if ($share->getShareType() === IShare::TYPE_USER) {
|
||||||
$sharedWith = $this->userManager->get($share->getSharedWith());
|
$sharedWith = $this->userManager->get($share->getSharedWith());
|
||||||
$result['share_with'] = $share->getSharedWith();
|
$result['share_with'] = $share->getSharedWith();
|
||||||
|
@ -511,6 +502,11 @@ class ShareAPIController extends OCSController {
|
||||||
$permissions = Constants::PERMISSION_READ;
|
$permissions = Constants::PERMISSION_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: It might make sense to have a dedicated setting to allow/deny converting link shares into federated ones
|
||||||
|
if (($permissions & Constants::PERMISSION_READ) && $this->shareManager->outgoingServer2ServerSharesAllowed()) {
|
||||||
|
$permissions |= Constants::PERMISSION_SHARE;
|
||||||
|
}
|
||||||
|
|
||||||
$share->setPermissions($permissions);
|
$share->setPermissions($permissions);
|
||||||
|
|
||||||
// Set password
|
// Set password
|
||||||
|
@ -1055,6 +1051,11 @@ class ShareAPIController extends OCSController {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($newPermissions !== null) {
|
if ($newPermissions !== null) {
|
||||||
|
// TODO: It might make sense to have a dedicated setting to allow/deny converting link shares into federated ones
|
||||||
|
if (($newPermissions & Constants::PERMISSION_READ) && $this->shareManager->outgoingServer2ServerSharesAllowed()) {
|
||||||
|
$newPermissions |= Constants::PERMISSION_SHARE;
|
||||||
|
}
|
||||||
|
|
||||||
$share->setPermissions($newPermissions);
|
$share->setPermissions($newPermissions);
|
||||||
$permissions = $newPermissions;
|
$permissions = $newPermissions;
|
||||||
}
|
}
|
||||||
|
|
|
@ -999,7 +999,8 @@ class ApiTest extends TestCase {
|
||||||
\OCP\Constants::PERMISSION_READ |
|
\OCP\Constants::PERMISSION_READ |
|
||||||
\OCP\Constants::PERMISSION_CREATE |
|
\OCP\Constants::PERMISSION_CREATE |
|
||||||
\OCP\Constants::PERMISSION_UPDATE |
|
\OCP\Constants::PERMISSION_UPDATE |
|
||||||
\OCP\Constants::PERMISSION_DELETE,
|
\OCP\Constants::PERMISSION_DELETE |
|
||||||
|
\OCP\Constants::PERMISSION_SHARE,
|
||||||
$share1->getPermissions()
|
$share1->getPermissions()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ Feature: sharing
|
||||||
| share_type | 3 |
|
| share_type | 3 |
|
||||||
| file_source | A_NUMBER |
|
| file_source | A_NUMBER |
|
||||||
| file_target | /FOLDER |
|
| file_target | /FOLDER |
|
||||||
| permissions | 15 |
|
| permissions | 31 |
|
||||||
| stime | A_NUMBER |
|
| stime | A_NUMBER |
|
||||||
| token | A_TOKEN |
|
| token | A_TOKEN |
|
||||||
| storage | A_NUMBER |
|
| storage | A_NUMBER |
|
||||||
|
@ -259,7 +259,7 @@ Feature: sharing
|
||||||
| share_type | 3 |
|
| share_type | 3 |
|
||||||
| file_source | A_NUMBER |
|
| file_source | A_NUMBER |
|
||||||
| file_target | /FOLDER |
|
| file_target | /FOLDER |
|
||||||
| permissions | 15 |
|
| permissions | 31 |
|
||||||
| stime | A_NUMBER |
|
| stime | A_NUMBER |
|
||||||
| token | A_TOKEN |
|
| token | A_TOKEN |
|
||||||
| storage | A_NUMBER |
|
| storage | A_NUMBER |
|
||||||
|
|
Loading…
Reference in New Issue