Skip to content

Commit d416743

Browse files
committed
Fix add user error
Signed-off-by: Daniel Valdivia <[email protected]>
1 parent 761b703 commit d416743

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

restapi/admin_users.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,14 @@ func addUser(ctx context.Context, client MinioAdmin, accessKey, secretKey *strin
169169
return nil, err
170170
}
171171
// set groups for the newly created user
172+
var userWithGroups *models.User
172173
if len(groups) > 0 {
173-
userElem, errUG := updateUserGroups(ctx, client, *accessKey, groups)
174+
var errUG error
175+
userWithGroups, errUG = updateUserGroups(ctx, client, *accessKey, groups)
174176

175177
if errUG != nil {
176178
return nil, errUG
177179
}
178-
return userElem, nil
179180
}
180181
// set policies for the newly created user
181182
if len(policies) > 0 {
@@ -187,9 +188,9 @@ func addUser(ctx context.Context, client MinioAdmin, accessKey, secretKey *strin
187188

188189
userRet := &models.User{
189190
AccessKey: *accessKey,
190-
MemberOf: nil,
191-
Policy: []string{},
192-
Status: "",
191+
MemberOf: userWithGroups.MemberOf,
192+
Policy: policies,
193+
Status: userWithGroups.Status,
193194
}
194195
return userRet, nil
195196
}

0 commit comments

Comments
 (0)