Skip to content

Commit

Permalink
Fixes: Issue burnash#1507
Browse files Browse the repository at this point in the history
  • Loading branch information
wobYY committed Sep 24, 2024
1 parent 014f25b commit 124ede7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gspread/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,19 @@ def copy(
for p in permissions:
if p.get("deleted"):
continue

# .list_permissions() returns a list of permissions,
# even the folder permissions if the file is in a shared folder.
# We only want the permissions that are directly applied to the
# spreadsheet file, i.e. 'writer', 'commenter' and 'reader'.
perm_details = {
p_details.get("permissionType"): p_details.get("inherited")
for p_details in p.get("permissionDetails")
}
if p.get("role") in ("organizer", "fileOrganizer") and (
perm_details.get("file") or perm_details.get("member")
):
continue

# In case of domain type the domain extract the domain
# In case of user/group extract the emailAddress
Expand Down

0 comments on commit 124ede7

Please sign in to comment.