From 1c3449b1f7cacc5a01bc6f063197ba6d3fd48301 Mon Sep 17 00:00:00 2001 From: Zaid Albirawi Date: Thu, 24 Oct 2024 13:09:01 -0400 Subject: [PATCH] Update rego example --- src/deployments/opa/dashboard.rego | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/deployments/opa/dashboard.rego b/src/deployments/opa/dashboard.rego index f0d97da..ed7380c 100644 --- a/src/deployments/opa/dashboard.rego +++ b/src/deployments/opa/dashboard.rego @@ -102,11 +102,16 @@ deny[x] { x := "You are not permitted you use Custom Go Plugin Authetication." } -apply_group_ownership = ownership { - input.request.body["x-tyk-api-gateway"] != null - ownership := {} -} else = ownership { - ownership := {"user_group_owners": [input.user.group_id]} +apply_group_ownership = payload { + input.request.body["api_definition"] != null + input.user.group_id != "" + payload := {"user_group_owners": [input.user.group_id]} +} else = payload { + endswith(input.request.path, "/access") + input.user.group_id != "" + payload := {"userGroupIds": [input.user.group_id]} +} else = payload { + payload := {} } patch_request[x] {