Skip to content

Commit

Permalink
transform-folder fix: remove share permissions from old share-folde…
Browse files Browse the repository at this point in the history
…rs prior to deleting
  • Loading branch information
aaunario-keeper authored and sk-keeper committed Aug 2, 2024
1 parent 96503ac commit 3c51c98
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions keepercommander/commands/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

from . import base
from .base import user_choice, dump_report_data, suppress_exit, raise_parse_exception, Command, GroupCommand, RecordMixin
from .register import ShareFolderCommand
from .. import api, display, vault, vault_extensions, crypto, utils
from ..error import CommandError, KeeperApiError, Error
from ..params import KeeperParams
Expand Down Expand Up @@ -1495,6 +1496,12 @@ def get_copy(original_folder): # type: (BaseFolderNode) -> BaseFolderNode

def remove_trees(roots): # type: (Iterable[BaseFolderNode]) -> None
if roots:
# Remove share-folder permissions prior to removal
sf_subfolders = [get_shared_folders(root) for root in roots]
sf_cmd = ShareFolderCommand()
for sfs in sf_subfolders:
for sf in sfs:
sf_cmd.execute(params, action='remove', user=['@existing'], folder=sf.get('shared_folder_uid'))
rmdir_cmd = FolderRemoveCommand()
rmdir_cmd.execute(params, pattern=[root.uid for root in roots], force=True, quiet=True)
api.sync_down(params)
Expand Down

0 comments on commit 3c51c98

Please sign in to comment.