From 169ee4896d376fcc966d8c76789b1bda42240806 Mon Sep 17 00:00:00 2001 From: Mike Mason Date: Thu, 24 Oct 2024 10:11:40 -0500 Subject: [PATCH] Add missing fields (#295) * add missing manager field in response Signed-off-by: Mike Mason * validate that action and type names are configured Signed-off-by: Mike Mason --------- Signed-off-by: Mike Mason --- internal/iapl/policy.go | 8 ++++++++ internal/query/roles_v2.go | 1 + 2 files changed, 9 insertions(+) diff --git a/internal/iapl/policy.go b/internal/iapl/policy.go index 2eb55f80..f58dcd0d 100644 --- a/internal/iapl/policy.go +++ b/internal/iapl/policy.go @@ -388,6 +388,14 @@ func (v *policy) validateActionBindings() error { bindingMap := make(map[bindingMapKey]struct{}, len(v.p.ActionBindings)) for i, binding := range v.bn { + if binding.ActionName == "" { + return fmt.Errorf("%d (%s:%s): %w", i, binding.TypeName, binding.ActionName, ErrorUnknownAction) + } + + if binding.TypeName == "" { + return fmt.Errorf("%d (%s:%s): %w", i, binding.TypeName, binding.ActionName, ErrorUnknownType) + } + key := bindingMapKey{ actionName: binding.ActionName, typeName: binding.TypeName, diff --git a/internal/query/roles_v2.go b/internal/query/roles_v2.go index dbae851b..39442702 100644 --- a/internal/query/roles_v2.go +++ b/internal/query/roles_v2.go @@ -83,6 +83,7 @@ func (e *engine) CreateRoleV2(ctx context.Context, actor, owner types.Resource, return types.Role{}, err } + role.Manager = dbRole.Manager role.CreatedBy = dbRole.CreatedBy role.UpdatedBy = dbRole.UpdatedBy role.ResourceID = dbRole.ResourceID