added skipping of policy evaluation for super and system admin

This commit is contained in:
2026-01-27 10:13:50 +08:00
parent 71923eb634
commit 8b589e5a55
+11
View File
@@ -127,6 +127,17 @@ func evaluatePolicy(policyAttribute models.PolicyAttribute, ctx *models.Authoriz
log.Print("Attribute Type: ", policyAttribute.AttributeType)
// Skip region checks for roleID 1, 2, or Admin roles
log.Print("Role ID!!!!!: ", ctx.RoleID)
if policyAttribute.AttributeType == "user" &&
policyAttribute.AttributeName == "region" &&
(ctx.RoleID == "1" || ctx.RoleID == "2" || ctx.RoleID == "Super Admin" ||
ctx.RoleID == "System Admin") {
fmt.Printf("[POLICY EVALUATION] Type: %s, Attribute: %s\n", policyAttribute.AttributeType, policyAttribute.AttributeName)
fmt.Printf(" Skipped for roleID: %s (Super | System Admin bypass)\n\n", ctx.RoleID)
return true, ""
}
switch policyAttribute.AttributeType {
case "user":
log.Print("Fetching from User Attributes")