Skip to content

Commit

Permalink
Update src/auth.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Jay <[email protected]>
  • Loading branch information
bolmsten and Junjiequan authored Dec 11, 2024
1 parent ae4c4d6 commit 6066ca5
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,12 @@ export const hasFileAccess = async (



const valid = await dataSetAPI.datasetsControllerFindById({pid: authRequest.dataset}).then(
(value) =>
{
if(value.isPublished || // Check if proposal is public
value.accessGroups.some(item => new Set(authRequest.jwt.groups).has(item)) || // Check if user has one or more of the access groups of dataset
authRequest.jwt.groups.indexOf(value.ownerGroup) > -1) //Check if user has the owner group
{
return true;
}
const isPublic = value.isPublished;
const hasAccessGroup = value.accessGroups.some(item => new Set(authRequest.jwt.groups).has(item));
const hasOwnerGroup = authRequest.jwt.groups.includes(value.ownerGroup);
if (isPublic || hasAccessGroup || hasOwnerGroup) {
return true;
}

return false;

Expand Down

0 comments on commit 6066ca5

Please sign in to comment.