Merge pull request #971 from ywk253100/161028_fix_961

User can not be deleted in LDAP authentication mode.
This commit is contained in:
Daniel Jiang 2016-10-31 12:39:24 +08:00 committed by GitHub
commit 171b17b202

View File

@ -241,6 +241,12 @@ func (ua *UserAPI) Delete() {
return 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 { if ua.currentUserID == ua.userID {
ua.CustomAbort(http.StatusForbidden, "can not delete yourself") ua.CustomAbort(http.StatusForbidden, "can not delete yourself")
} }