user can not be deleted in LDAP authentication mode

This commit is contained in:
Wenkai Yin
2016-10-31 10:53:11 +08:00
parent ce40b26ff2
commit 8fe0a333a8
+6
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")
}