0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00

Merge pull request #2509 from jeddai/disable-changes-from-non-authors

Disable changes from non authors
This commit is contained in:
Trevor Buckner
2022-12-12 12:15:23 -05:00
committed by GitHub

View File

@@ -43,6 +43,9 @@ const getBrew = (accessType, stubOnly = false)=>{
}
});
stub = stub?.toObject();
if(accessType === 'edit' && stub?.authors?.length > 0 && !stub?.authors.includes(req.account?.username)) {
throw 'Current logged in user does not have access to this brew.';
}
// If there is a google id, try to find the google brew
if(!stubOnly && (googleId || stub?.googleId)) {