some fix for UI login

This commit is contained in:
gowthaman.b
2023-11-12 16:12:19 +05:30
parent 4e0d5d0296
commit ac36d7e8c7
6 changed files with 100 additions and 6 deletions

View File

@@ -46,12 +46,12 @@ class AppAccessManager : AccessManager {
}
val isAllowed = currentRoles().count { allowedRoles.contains(it) } > 0
logger.warn("entity - $entity, action $action, userroles = ${currentRoles()}, allowed = $allowedRoles, isAllowed? $isAllowed, enforce? ${appConfig.enforceRoleRestriction()}")
logger.warn("entity - $entity, action $action, user roles = ${currentRoles()}, allowed = $allowedRoles, isAllowed? $isAllowed, enforce? ${appConfig.enforceRoleRestriction()}")
if (isAllowed || !appConfig.enforceRoleRestriction() || allowedRoles.isEmpty()) {
//if role is allowed, or enforcement is turned off or no roles are explicitly allowed
handler.handle(ctx)
} else {
ctx.status(HttpStatus.UNAUTHORIZED).result("unauthorized request")
ctx.status(HttpStatus.FORBIDDEN).result("user not allowed to do this")
}
}
}