Merge pull request #1620 from automatisch/fix-authorization-middleware

fix: Include http methods for route rules
This commit is contained in:
Ömer Faruk Aydın
2024-02-20 12:59:12 +01:00
committed by GitHub

View File

@@ -1,16 +1,17 @@
const authorizationList = {
'/api/v1/users/:userId': {
'GET /api/v1/users/:userId': {
action: 'read',
subject: 'User',
},
'/api/v1/users/': {
'GET /api/v1/users/': {
action: 'read',
subject: 'User',
},
};
export const authorizeUser = async (request, response, next) => {
const currentRoute = request.baseUrl + request.route.path;
const currentRoute =
request.method + ' ' + request.baseUrl + request.route.path;
const currentRouteRule = authorizationList[currentRoute];
try {