I’m working on file sharing on Google Drive in my android app. Here is the scenario… User A shares a file with User B, gives him/her the “writer” role. Later, forgetful User A, again, shares the same file with User B, giving him/her the “reader” role this time. My question is, will this override the first permission? or should the app handle checking of existing file permissions?
Share
You can use
drive.permissions.updateto updateroleproperty of apermission, provided that you havefileIdandpermissionId. Theroleproperty will be overridden. But if you notice, there is aadditionalRoles[]property that will allow you to add secondary roles to that permission given to a user. Right now, onlycommenteris allowed. Maybe in the future, more roles will be added in that property.You can confirm by yourself using Google API Explorer:
drive.files.listrequest to getfileIdof a sharedfile.
drive.permissions.listrequest with thefileIdto getpermissionIdof a user (it is theidin the reponse).fileIdandpermissionId, now you can usedrive.permissions.updateto change the role of that user by sendthe request with
roleproperty in the body.