@go-mailer/jarvis 5.0.6 → 5.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/middlewares/auth.js
CHANGED
|
@@ -90,11 +90,11 @@ const authenticateUser = async (request, response, next) => {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
const authorizeUser =
|
|
93
|
+
const authorizeUser = ({ action, resource }) => {
|
|
94
94
|
return async (request, response, next) => {
|
|
95
95
|
try {
|
|
96
96
|
const { is_admin, tenant_id, user_id } = request
|
|
97
|
-
if (is_admin) next()
|
|
97
|
+
if (is_admin) return next()
|
|
98
98
|
|
|
99
99
|
await checkAuthority({ action, resource, tenant_id, user_id })
|
|
100
100
|
next()
|
|
@@ -53,7 +53,7 @@ function RequestLogger () {
|
|
|
53
53
|
status_code: payload ? payload.status_code : statusCode
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
log.error = payload ? payload.error : statusMessage
|
|
57
57
|
// if (error) {
|
|
58
58
|
// log.error = error;
|
|
59
59
|
// logtail.error(pathname, hashLogData(log));
|
|
@@ -62,7 +62,7 @@ function RequestLogger () {
|
|
|
62
62
|
// }
|
|
63
63
|
|
|
64
64
|
// logtail.flush();
|
|
65
|
-
console.log(pathname, hashLogData({
|
|
65
|
+
console.log(pathname, hashLogData({ status_code: log.status_code, request_id: log.request_id }))
|
|
66
66
|
})
|
|
67
67
|
|
|
68
68
|
next()
|