From 339a8ac5d21a14d921c92b1646a34180b8d104ce Mon Sep 17 00:00:00 2001 From: Shubhendu Ram Tripathi Date: Thu, 5 Sep 2024 15:42:19 +0530 Subject: [PATCH] correct usages of IAMErrPolicyEntity Signed-off-by: Shubhendu Ram Tripathi --- cmd/admin-cluster-iam-import.go | 15 +++++---------- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/cmd/admin-cluster-iam-import.go b/cmd/admin-cluster-iam-import.go index 84ea767f95..c7c08bc2aa 100644 --- a/cmd/admin-cluster-iam-import.go +++ b/cmd/admin-cluster-iam-import.go @@ -86,7 +86,7 @@ func processIAMEntities(entities madmin.IAMEntities, action string) []string { messages = append(messages, fmt.Sprintf("%s groups: %v", action, strings.Join(entities.Groups, ", "))) } if len(entities.ServiceAccounts) > 0 { - messages = append(messages, fmt.Sprintf("%s service acoounts: %v", action, strings.Join(entities.ServiceAccounts, ", "))) + messages = append(messages, fmt.Sprintf("%s service accounts: %v", action, strings.Join(entities.ServiceAccounts, ", "))) } var users []string for _, pol := range entities.UserPolicies { @@ -120,6 +120,7 @@ func processIAMEntities(entities madmin.IAMEntities, action string) []string { func processErrIAMEntities(entities madmin.IAMErrEntities) []string { var messages []string + var policies []string for _, entry := range entities.Policies { policies = append(policies, entry.Name) @@ -150,27 +151,21 @@ func processErrIAMEntities(entities madmin.IAMErrEntities) []string { } var polusers []string for _, pol := range entities.UserPolicies { - for name := range pol.PolicyMap { - polusers = append(polusers, name) - } + polusers = append(polusers, pol.Name) } if len(polusers) > 0 { messages = append(messages, fmt.Sprintf("Failed to add policies for users: %v", strings.Join(polusers, ", "))) } var polgroups []string for _, pol := range entities.GroupPolicies { - for name := range pol.PolicyMap { - polgroups = append(polgroups, name) - } + polgroups = append(polgroups, pol.Name) } if len(polgroups) > 0 { messages = append(messages, fmt.Sprintf("Failed to add policies for groups: %v", strings.Join(polgroups, ", "))) } var polsts []string for _, pol := range entities.STSPolicies { - for name := range pol.PolicyMap { - polsts = append(polsts, name) - } + polsts = append(polsts, pol.Name) } if len(polsts) > 0 { messages = append(messages, fmt.Sprintf("Failed to add policies for sts: %v", strings.Join(polsts, ", "))) diff --git a/go.mod b/go.mod index 4ca85afab8..49e1fd9f77 100644 --- a/go.mod +++ b/go.mod @@ -119,4 +119,4 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace github.com/minio/madmin-go/v3 v3.0.64 => github.com/shtripat/madmin-go/v3 v3.0.0-20240903073137-3b373d73c09c +replace github.com/minio/madmin-go/v3 v3.0.64 => github.com/shtripat/madmin-go/v3 v3.0.0-20240905100705-0302fd48cd5e diff --git a/go.sum b/go.sum index 446bfd2ce2..de02aca0ef 100644 --- a/go.sum +++ b/go.sum @@ -209,8 +209,8 @@ github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFt github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= -github.com/shtripat/madmin-go/v3 v3.0.0-20240903073137-3b373d73c09c h1:d4MW+GoDObqdFILBeXfojfkYV8p7JwG+v5pQbh18pIc= -github.com/shtripat/madmin-go/v3 v3.0.0-20240903073137-3b373d73c09c/go.mod h1:IFAwr0XMrdsLovxAdCcuq/eoL4nRuMVQQv0iubJANQw= +github.com/shtripat/madmin-go/v3 v3.0.0-20240905100705-0302fd48cd5e h1:SKPId/MszE2JrSxFuh9DR6FS1NU70QIPrc2h3ZioSl0= +github.com/shtripat/madmin-go/v3 v3.0.0-20240905100705-0302fd48cd5e/go.mod h1:IFAwr0XMrdsLovxAdCcuq/eoL4nRuMVQQv0iubJANQw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=