added skipping of policy evaluation for super and system admin
This commit is contained in:
@@ -127,6 +127,17 @@ func evaluatePolicy(policyAttribute models.PolicyAttribute, ctx *models.Authoriz
|
|||||||
|
|
||||||
log.Print("Attribute Type: ", policyAttribute.AttributeType)
|
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 {
|
switch policyAttribute.AttributeType {
|
||||||
case "user":
|
case "user":
|
||||||
log.Print("Fetching from User Attributes")
|
log.Print("Fetching from User Attributes")
|
||||||
|
|||||||
Reference in New Issue
Block a user