mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
Better error when setting up replication with a service account alias (#16472)
This commit is contained in:
@@ -2093,14 +2093,14 @@ func (store *IAMStoreSys) AddServiceAccount(ctx context.Context, cred auth.Crede
|
||||
if su, found := cache.iamUsersMap[accessKey]; found {
|
||||
scred := su.Credentials
|
||||
if scred.ParentUser != parentUser {
|
||||
return updatedAt, errIAMServiceAccountUsed
|
||||
return updatedAt, fmt.Errorf("%w: the service account access key is taken by another user", errIAMServiceAccountNotAllowed)
|
||||
}
|
||||
return updatedAt, errIAMServiceAccount
|
||||
return updatedAt, fmt.Errorf("%w: the service account access key already taken", errIAMServiceAccountNotAllowed)
|
||||
}
|
||||
|
||||
// Parent user must not be a service account.
|
||||
if u, found := cache.iamUsersMap[parentUser]; found && u.Credentials.IsServiceAccount() {
|
||||
return updatedAt, errIAMServiceAccount
|
||||
return updatedAt, fmt.Errorf("%w: unable to create a service account for another service account", errIAMServiceAccountNotAllowed)
|
||||
}
|
||||
|
||||
u := newUserIdentity(cred)
|
||||
|
||||
Reference in New Issue
Block a user