-
Notifications
You must be signed in to change notification settings - Fork 979
Fixed APIError: [403] when copying permissions
#1515
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
base: master
Are you sure you want to change the base?
Conversation
|
hi ! thanks for the change :) I have fixed a couple of linting issues. There is a typing issue that otherwise, I think your change makes sense. we will try to get the workflows fixed and then think about merging :) |
|
Hey @lavigne958 I would like to help with fixing this and pushing it along. Could you share what should be tested and to what degree? |
|
hi :] shame @lavigne958 is busy I think the error has to do with the typing of the return value of this function(?), so mypy complains that you cannot use gspread/gspread/spreadsheet.py Lines 546 to 548 in 6775c81
do you think it is possible to add a test that can fail/pass this bug, so we do not re-introduce it in future? |
Yup, had to add an additional Typing definition - Found, fixed and tested. Linting isn't screaming anymore with an error.
I was thinking of adding something like below: This would test both copying of permissions and then on top of that, that being done in the Shared Drive. I'm testing on my company drive so my test service account doesn't have the permission to delete the file which is done at the end of the test. I'm awaiting my manager's approval on account getting a temporary full access so it can delete the files in that folder in the Shared Drive and successfully complete the test. |
|
hi ! sorry for the rushed comment, but... will you push the code onto this branch so we can test the CI ? thanks for this effort ! :] I may return |
|
Hey, no worries at all :) My plan is to merge to the master on my fork after I create the test just so the PR doesn't get spammed with the linting Github Action. If you prefer the test to be part of a separate PR let me know and I can merge the code without the test implementation. |
This PR addresses issue burnash#1507 which caused a 403 error when copying permissions from a spreadsheet located in a shared drive. Key changes: - Filters out folder-level permissions (organizer/fileOrganizer roles) - Only copies permissions directly applied to spreadsheet files (writer, commenter, reader) - Enhanced typing annotations to resolve mypy complaints - All 141 unit tests pass successfully Status: Safe to merge - narrowly scoped bug fix, well tested
This PR fixes the bug raised in the issue #1507.
tox test (replaced the first part of the path with
local_dirto remove personal information):Also tested by copying a random spreadsheet in my workspace. For debugging I added a print in the
ifblock:The result (screenshot):
011...has theorganizerrole which is a folder permission, skipping...027...has thefileOrganizerrole which is a folder permission, skipping...029...has thecommenterrole, adding permission033...has thefileOrganizerrole which is a folder permission, skipping...061...has theorganizerrole which is a folder permission, skipping...083...has thefileOrganizerrole which is a folder permission, skipping...085...has thefileOrganizerrole which is a folder permission, skipping...087...has theorganizerrole which is a folder permission, skipping...131...has thewriterrole, adding permission134...has thefileOrganizerrole which is a folder permission, skipping...146...has thefileOrganizerrole which is a folder permission, skipping...152...has theorganizerrole which is a folder permission, skipping...Correctly shared:
