From e09deb6889deb53f44ff6344d0900da0492b662d Mon Sep 17 00:00:00 2001 From: Misi Date: Fri, 31 Oct 2025 11:48:01 +0100 Subject: [PATCH] IAM: Use the new authorizer for Teams (#113275) Use the new authorizer for Teams --- pkg/registry/apis/iam/authorizer.go | 2 +- pkg/tests/apis/iam/team_integration_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/registry/apis/iam/authorizer.go b/pkg/registry/apis/iam/authorizer.go index 439f0de2da5..db7c2727fb7 100644 --- a/pkg/registry/apis/iam/authorizer.go +++ b/pkg/registry/apis/iam/authorizer.go @@ -24,7 +24,6 @@ func newIAMAuthorizer(accessClient authlib.AccessClient, legacyAccessClient auth // Identity specific resources legacyAuthorizer := gfauthorizer.NewResourceAuthorizer(legacyAccessClient) - resourceAuthorizer[iamv0.TeamResourceInfo.GetName()] = legacyAuthorizer resourceAuthorizer[iamv0.TeamBindingResourceInfo.GetName()] = legacyAuthorizer resourceAuthorizer["display"] = legacyAuthorizer @@ -36,6 +35,7 @@ func newIAMAuthorizer(accessClient authlib.AccessClient, legacyAccessClient auth resourceAuthorizer[iamv0.RoleBindingInfo.GetName()] = authorizer resourceAuthorizer[iamv0.ServiceAccountResourceInfo.GetName()] = authorizer resourceAuthorizer[iamv0.UserResourceInfo.GetName()] = authorizer + resourceAuthorizer[iamv0.TeamResourceInfo.GetName()] = authorizer return &iamAuthorizer{resourceAuthorizer: resourceAuthorizer} } diff --git a/pkg/tests/apis/iam/team_integration_test.go b/pkg/tests/apis/iam/team_integration_test.go index 16d27456e03..ef804987fd4 100644 --- a/pkg/tests/apis/iam/team_integration_test.go +++ b/pkg/tests/apis/iam/team_integration_test.go @@ -113,7 +113,7 @@ func doTeamCRUDTestsUsingTheNewAPIs(t *testing.T, helper *apis.K8sTestHelper) { var statusErr *errors.StatusError require.ErrorAs(t, err, &statusErr) require.Equal(t, "Failure", statusErr.ErrStatus.Status) - require.Contains(t, statusErr.ErrStatus.Message, "team not found") + require.Contains(t, statusErr.ErrStatus.Message, "not found") }) t.Run("should not be able to create team when using a user with insufficient permissions", func(t *testing.T) { @@ -332,6 +332,6 @@ func doTeamCRUDTestsUsingTheLegacyAPIs(t *testing.T, helper *apis.K8sTestHelper, var statusErr *errors.StatusError require.ErrorAs(t, err, &statusErr) require.Equal(t, "Failure", statusErr.ErrStatus.Status) - require.Contains(t, statusErr.ErrStatus.Message, "team not found") + require.Contains(t, statusErr.ErrStatus.Message, "not found") }) }