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

fix: prevent sharing permissions on user root folder #40195

Merged
merged 1 commit into from
Sep 4, 2023

Conversation

skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented Sep 1, 2023

A user root folder is not shareable.

// And you cannot share your rootfolder
if ($this->userManager->userExists($share->getSharedBy())) {
$userFolder = $this->rootFolder->getUserFolder($share->getSharedBy());
} else {
$userFolder = $this->rootFolder->getUserFolder($share->getShareOwner());
}
if ($userFolder->getId() === $share->getNode()->getId()) {
throw new \InvalidArgumentException('You cannot share your root folder');
}

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
@skjnldsv skjnldsv added bug 2. developing Work in progress labels Sep 1, 2023
@skjnldsv skjnldsv added this to the Nextcloud 28 milestone Sep 1, 2023
@skjnldsv skjnldsv self-assigned this Sep 1, 2023
@skjnldsv
Copy link
Member Author

skjnldsv commented Sep 1, 2023

/backport to stable27

@skjnldsv
Copy link
Member Author

skjnldsv commented Sep 1, 2023

/backport to stable26

@skjnldsv skjnldsv requested review from a team, ArtificialOwl, sorbaugh, come-nc, icewind1991 and nickvergessen and removed request for a team September 1, 2023 12:08
@skjnldsv skjnldsv added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Sep 1, 2023
@skjnldsv skjnldsv merged commit db19b25 into master Sep 4, 2023
40 checks passed
@skjnldsv skjnldsv deleted the fix/defaultpermissions-rootfolder branch September 4, 2023 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants