fix: assume parentUser correctly for serviceAccounts (#9504)

ListServiceAccounts/DeleteServiceAccount didn't work properly
with STS credentials yet due to incorrect Parent user.
This commit is contained in:
Harshavardhana
2020-05-01 08:05:14 -07:00
committed by GitHub
parent 09571d03a5
commit 28f9c477a8
3 changed files with 19 additions and 11 deletions
+4 -5
View File
@@ -889,11 +889,10 @@ func (sys *IAMSys) GetServiceAccountParent(ctx context.Context, accessKey string
defer sys.store.runlock()
sa, ok := sys.iamUsersMap[accessKey]
if !ok || !sa.IsServiceAccount() {
return "", errNoSuchServiceAccount
if ok && sa.IsServiceAccount() {
return sa.ParentUser, nil
}
return sa.ParentUser, nil
return "", nil
}
// DeleteServiceAccount - delete a service account
@@ -908,7 +907,7 @@ func (sys *IAMSys) DeleteServiceAccount(ctx context.Context, accessKey string) e
sa, ok := sys.iamUsersMap[accessKey]
if !ok || !sa.IsServiceAccount() {
return errNoSuchServiceAccount
return nil
}
// It is ok to ignore deletion error on the mapped policy