Skip to content

Commit

Permalink
better permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
Konard committed Aug 6, 2023
1 parent 83900bb commit d8b468b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ app.post('/file', async (req, res, next) => {
console.log('/file post proxy','error: ', e);
}
if (!userId) res.status(403).send('Update CAN NOT be processes');
const canResult = await deep.can(linkId, userId, await deep.id('@deep-foundation/core', 'AllowUpdateType')) || await deep.can(userId, userId, await deep.id('@deep-foundation/core', 'AllowAdmin'));
console.log('/file post proxy','can', await deep.can(linkId, userId, await deep.id('@deep-foundation/core', 'AllowUpdateType')), 'isAdmin', await deep.can(userId, userId, await deep.id('@deep-foundation/core', 'AllowAdmin')));
const canResult = await deep.can(linkId, userId, await deep.id('@deep-foundation/core', 'AllowUpdateType')) || await deep.can(null, userId, await deep.id('@deep-foundation/core', 'AllowAdmin'));
console.log('/file post proxy','can', await deep.can(linkId, userId, await deep.id('@deep-foundation/core', 'AllowUpdateType')), 'isAdmin', await deep.can(null, userId, await deep.id('@deep-foundation/core', 'AllowAdmin')));
console.log('/file post proxy','userId', userId, typeof(userId));
console.log('/file post proxy','canResult', canResult);
if (!canResult) return res.status(403).send(`You cant update link ##${linkId} as user ##${userId}, and user ##${userId} is not admin.`);
Expand Down

0 comments on commit d8b468b

Please sign in to comment.