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

add command do delete orphan shares #39170

Merged
merged 1 commit into from Jul 10, 2023
Merged

Conversation

icewind1991
Copy link
Member

@icewind1991 icewind1991 commented Jul 5, 2023

Compared to the existing background job, this command validates that the share owner still has access to the file instead of just checking that the file still exists.

I've decided against not adding this to the background command as the "owner lost access" case is recoverable by having the owner regain access. So automatically deleting them might be undesired.

Steps to create an orphaned share:

  • Setup user A, B and C. Create a groupfolder G and give A and B access to it.
  • User B uploads a file F to G and shares it with C
  • User A moves F outside G
  • C now has an orphaned share as B no longer has access to F

@icewind1991 icewind1991 added the 3. to review Waiting for reviews label Jul 5, 2023
@icewind1991 icewind1991 added this to the Nextcloud 28 milestone Jul 5, 2023
@icewind1991 icewind1991 requested a review from a team July 5, 2023 15:16
@icewind1991 icewind1991 force-pushed the orphan-share-command branch 2 times, most recently from 3ac1cc7 to 4c31c31 Compare July 5, 2023 15:23
Signed-off-by: Robin Appelman <robin@icewind.nl>
@AndyScherzinger
Copy link
Member

/backport to stable27

@AndyScherzinger
Copy link
Member

/backport to stable26

Copy link
Contributor

@artonge artonge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Does it really scale to fetch all share and then to set up the file system for each owner? Or does the yield statement makes it more manageable? Not familiar with it.
  • Do we have a logic in place to prevent those from happening?

}

if ($doDelete) {
$this->orphanHelper->deleteShares($orphans);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No option to delete them one by one? Maybe it is irrelevant in the use case.

@icewind1991
Copy link
Member Author

Does it really scale to fetch all share and then to set up the file system for each owner? Or does the yield statement makes it more manageable? Not familiar with it.

It will be slow yes, but there isn't really to much that can be done for that

@AndyScherzinger
Copy link
Member

AndyScherzinger commented Jul 10, 2023

If it only makes the command slow then I'd say that is fine or would it also impact "online" transactions? 👍

@icewind1991
Copy link
Member Author

Performance impact is only for the command

@icewind1991 icewind1991 merged commit a84fa17 into master Jul 10, 2023
38 of 40 checks passed
@icewind1991 icewind1991 deleted the orphan-share-command branch July 10, 2023 11:17
@backportbot-nextcloud
Copy link

The backport to stable26 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable26
git pull origin stable26

# Create the new backport branch
git checkout -b fix/foo-stable26

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable26

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

@nextcloud nextcloud deleted a comment from backportbot-nextcloud bot Jul 10, 2023
@nextcloud nextcloud deleted a comment from backportbot-nextcloud bot Jul 10, 2023
@nextcloud nextcloud deleted a comment from backportbot-nextcloud bot Jul 10, 2023
@ChristophWurst ChristophWurst added the pending documentation This pull request needs an associated documentation update label Jan 15, 2024
@ChristophWurst
Copy link
Member

The new occ command needs admin docs

@Rello
Copy link
Contributor

Rello commented Jan 15, 2024

nextcloud/documentation#11443

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 backport-request pending documentation This pull request needs an associated documentation update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants