mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-02 04:51:22 +01:00
Merge pull request #657 from ywk253100/user
sys admin can not delete himself - API update
This commit is contained in:
commit
475c812d9a
@ -239,6 +239,11 @@ func (ua *UserAPI) Delete() {
|
||||
ua.RenderError(http.StatusForbidden, "User does not have admin role")
|
||||
return
|
||||
}
|
||||
|
||||
if ua.currentUserID == ua.userID {
|
||||
ua.CustomAbort(http.StatusForbidden, "can not delete yourself")
|
||||
}
|
||||
|
||||
var err error
|
||||
err = dao.DeleteUser(ua.userID)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user