Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable29] fix(files_sharing): Respect permissions passed when creating link shares #50272

Draft
wants to merge 1 commit into
base: stable29
Choose a base branch
from

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Jan 20, 2025

Manual backport of #50270

Given:
User creates a link or email share with permissions=4 (create only = file drop).

Problem:
Currently the permissions are automatically extended to permissions = 5
(READ + CREATE). Work around was to create the share and directly update
it.

Solution:
Respect what the user is requesting, create a file drop share.

Signed-off-by: Ferdinand Thiessen <[email protected]>
@susnux susnux added this to the Nextcloud 29.0.12 milestone Jan 20, 2025
@susnux susnux changed the title fix(files_sharing): Respect permissions passed when creating link shares [stable29] fix(files_sharing): Respect permissions passed when creating link shares Jan 20, 2025
// Shares always require read permissions
$permissions |= Constants::PERMISSION_READ;
if ($shareType === IShare::TYPE_LINK || $shareType === IShare::TYPE_EMAIL) {
$permissions = $this->getLinkSharePermissions($permissions, $publicUpload);

Check notice

Code scanning / Psalm

PossiblyNullArgument Note

Argument 1 of OCA\Files_Sharing\Controller\ShareAPIController::getLinkSharePermissions cannot be null, possibly null value provided
} else {
// Use default permissions only for non-link shares to keep legacy behavior
if ($permissions === null) {
$permissions = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL);

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OCP\IConfig::getAppValue has been marked as deprecated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant