diff --git a/cmd/admin-handlers-users.go b/cmd/admin-handlers-users.go index 37c3907ad..c1c9f6d21 100644 --- a/cmd/admin-handlers-users.go +++ b/cmd/admin-handlers-users.go @@ -525,12 +525,10 @@ func (a adminAPIHandlers) AddServiceAccount(w http.ResponseWriter, r *http.Reque } else { if cred.IsServiceAccount() || cred.IsTemp() { if cred.ParentUser == "" { - writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, errors.New("service accounts cannot be generated for temporary credentials without parent")), r.URL) + writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, + errors.New("service accounts cannot be generated for temporary credentials without parent")), r.URL) return } - targetUser = cred.ParentUser - } else { - targetUser = cred.AccessKey } targetGroups = cred.Groups }