fix: optimize IAM users load, add fallback (#9809)

Bonus fix, load service accounts properly
when service accounts were generated with
LDAP
This commit is contained in:
Harshavardhana
2020-06-11 14:11:30 -07:00
committed by GitHub
parent a42df3d364
commit 96ed0991b5
5 changed files with 143 additions and 69 deletions

View File

@@ -899,13 +899,26 @@ func toAdminAPIErr(ctx context.Context, err error) APIError {
HTTPStatusCode: e.StatusCode,
}
default:
if errors.Is(err, errConfigNotFound) {
switch {
case errors.Is(err, errConfigNotFound):
apiErr = APIError{
Code: "XMinioConfigError",
Description: err.Error(),
HTTPStatusCode: http.StatusNotFound,
}
} else {
case errors.Is(err, errIAMActionNotAllowed):
apiErr = APIError{
Code: "XMinioIAMActionNotAllowed",
Description: err.Error(),
HTTPStatusCode: http.StatusForbidden,
}
case errors.Is(err, errIAMNotInitialized):
apiErr = APIError{
Code: "XMinioIAMNotInitialized",
Description: err.Error(),
HTTPStatusCode: http.StatusServiceUnavailable,
}
default:
apiErr = errorCodes.ToAPIErrWithErr(toAdminAPIErrCode(ctx, err), err)
}
}