diff --git a/services/policy_evaluator.go b/services/policy_evaluator.go index 3457deb..228fd37 100644 --- a/services/policy_evaluator.go +++ b/services/policy_evaluator.go @@ -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")