0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-02 04:12:47 +00:00

If user is owner, fetch Google Brew with user auth

Fixes the case where a user can see a Google Brew under their account (`listBrew()` uses their personal auth) but can't actually delete it (`getBrew()`  only uses the serviceAccount). Occurs if a Google brew has lost its permissions somehow (set to "restricted", etc.) such that serviceAccount can no longer interact with it.
This commit is contained in:
Trevor Buckner
2024-12-08 23:42:14 -05:00
parent 74a7983757
commit 9758797e2b
3 changed files with 6 additions and 4 deletions

View File

@@ -241,8 +241,8 @@ const GoogleActions = {
return obj.data.id;
},
getGoogleBrew : async (id, accessId, accessType)=>{
const drive = googleDrive.drive({ version: 'v3', auth: defaultAuth });
getGoogleBrew : async (auth, id, accessId, accessType)=>{
const drive = googleDrive.drive({ version: 'v3', auth: auth || defaultAuth });
const obj = await drive.files.get({
fileId : id,