Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
andava aggiornato il controllo dei permessi avendo tolto api/v0 dai ruoli
  • Loading branch information
paolini committed Jan 11, 2024
1 parent 6d5e18c commit fa9ea3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dm-manager",
"version": "1.4.2",
"version": "1.4.3",
"private": true,
"dependencies": {
"@babel/core": "^7.16.0",
Expand Down
4 changes: 2 additions & 2 deletions server/controllers/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ const requirePathPermissions = async (req, res, next) => {
req.log_who = req.user.username
}

console.log(`checking permissions for ${req.log_who} on ${fullUrl}`)
console.log(`checking permissions for ${req.log_who} with roles ${JSON.stringify(req.roles)} on ${fullUrl}`)

const hasPermission = req.roles?.includes('admin') || req.roles.reduce(
(x,y) => x || fullUrl.startsWith(y), false
(x,y) => x || fullUrl.startsWith(`/api/v0${y}`), false
)

if (! hasPermission) {
Expand Down

0 comments on commit fa9ea3a

Please sign in to comment.