mirror of
https://github.com/minio/minio.git
synced 2025-04-01 10:13:42 -04:00
Improved error message for user and access key conflict (#7190)
This commit is contained in:
parent
85e939636f
commit
8af1f0cc7b
@ -1136,7 +1136,7 @@ func (a adminAPIHandlers) AddUser(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
// Custom IAM policies not allowed for admin user.
|
// Custom IAM policies not allowed for admin user.
|
||||||
if accessKey == globalServerConfig.GetCredential().AccessKey {
|
if accessKey == globalServerConfig.GetCredential().AccessKey {
|
||||||
writeErrorResponseJSON(w, ErrInvalidRequest, r.URL)
|
writeErrorResponseJSON(w, ErrAddUserInvalidArgument, r.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,6 +301,7 @@ const (
|
|||||||
ErrAdminConfigNotificationTargetsFailed
|
ErrAdminConfigNotificationTargetsFailed
|
||||||
ErrAdminProfilerNotEnabled
|
ErrAdminProfilerNotEnabled
|
||||||
ErrInvalidDecompressedSize
|
ErrInvalidDecompressedSize
|
||||||
|
ErrAddUserInvalidArgument
|
||||||
)
|
)
|
||||||
|
|
||||||
// error code to APIError structure, these fields carry respective
|
// error code to APIError structure, these fields carry respective
|
||||||
@ -1447,6 +1448,11 @@ var errorCodeResponse = map[APIErrorCode]APIError{
|
|||||||
Description: "The data provided is unfit for decompression",
|
Description: "The data provided is unfit for decompression",
|
||||||
HTTPStatusCode: http.StatusBadRequest,
|
HTTPStatusCode: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
|
ErrAddUserInvalidArgument: {
|
||||||
|
Code: "XMinioInvalidIAMCredentials",
|
||||||
|
Description: "User is not allowed to be same as admin access key",
|
||||||
|
HTTPStatusCode: http.StatusConflict,
|
||||||
|
},
|
||||||
// Add your error structure here.
|
// Add your error structure here.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user