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
1 changed files with 6 additions and 0 deletions

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")
}