mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-24 01:27:49 +01:00
sys admin can not delete himself
This commit is contained in:
parent
77448551ee
commit
5079a8d20c
@ -239,6 +239,11 @@ func (ua *UserAPI) Delete() {
|
|||||||
ua.RenderError(http.StatusForbidden, "User does not have admin role")
|
ua.RenderError(http.StatusForbidden, "User does not have admin role")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ua.currentUserID == ua.userID {
|
||||||
|
ua.CustomAbort(http.StatusForbidden, "can not delete yourself")
|
||||||
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
err = dao.DeleteUser(ua.userID)
|
err = dao.DeleteUser(ua.userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user