mbkauthe 4.8.2 → 4.8.3
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/middleware/auth.js
CHANGED
|
@@ -510,14 +510,14 @@ const checkRolePermission = (requiredRoles, notAllowed) => {
|
|
|
510
510
|
});
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
+
// Use role from validateSession to avoid additional DB query
|
|
514
|
+
const userRole = req.userRole;
|
|
515
|
+
|
|
513
516
|
// SuperAdmin bypasses all role checks
|
|
514
|
-
if(req.session.role === "SuperAdmin") {
|
|
517
|
+
if(req.session.role === "SuperAdmin" || userRole === "SuperAdmin") {
|
|
515
518
|
return next();
|
|
516
519
|
}
|
|
517
520
|
|
|
518
|
-
// Use role from validateSession to avoid additional DB query
|
|
519
|
-
const userRole = req.userRole;
|
|
520
|
-
|
|
521
521
|
// Check notAllowed role
|
|
522
522
|
if (notAllowed && userRole === notAllowed) {
|
|
523
523
|
if (isJsonRequest(req)) {
|
package/package.json
CHANGED