user can not be deleted in LDAP authentication mode

This commit is contained in:
Wenkai Yin 2016-10-28 14:47:19 +08:00
parent ce40b26ff2
commit 8fe0a333a8

View File

@ -241,6 +241,12 @@ func (ua *UserAPI) Delete() {
return
}
// TODO read from conifg
authMode := os.Getenv("AUTH_MODE")
if authMode == "ldap_auth" {
ua.CustomAbort(http.StatusForbidden, "user can not be deleted in LDAP authentication mode")
}
if ua.currentUserID == ua.userID {
ua.CustomAbort(http.StatusForbidden, "can not delete yourself")
}