Skip to content

Commit 41c976a

Browse files
committed
fix missing mode rejecting request
1 parent bb3d6db commit 41c976a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/parseRoutes.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ const handleRequest = (privilege, visibility, schema, unwrapResponse, callback)
140140
);
141141

142142
const getHandlerForRole = (privilege, visibility, callback, req) => {
143-
if (!isVisible(visibility, req.mode)) {
143+
if (req.mode && !isVisible(visibility, req.mode)) {
144+
console.error('rejecting request due to lack of visibility', visibility, req.mode);
144145
return sendError;
145146
}
146147
if (typeof privilege !== 'object') {
@@ -152,7 +153,7 @@ const getHandlerForRole = (privilege, visibility, callback, req) => {
152153
if (typeof privilege.any === 'function') {
153154
return privilege.any;
154155
}
155-
console.log('rejecting request due to lack of privilege', privilege, visibility, req.headers.role);
156+
console.error('rejecting request due to lack of privilege', privilege, visibility, req.headers.role);
156157
return sendError;
157158
};
158159

0 commit comments

Comments
 (0)