sys admin can not delete himself

This commit is contained in:
Wenkai Yin 2016-08-08 12:42:30 +08:00
parent 77448551ee
commit 5079a8d20c

View File

@ -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 {