#149: Properly fixed app sdk loop issues

This commit is contained in:
frikky
2020-09-16 20:52:11 +02:00
parent 6ec4fed722
commit 206ab2decb
6 changed files with 121 additions and 74 deletions
-5
View File
@@ -6467,11 +6467,6 @@ func init() {
r := mux.NewRouter()
r.HandleFunc("/api/v1/_ah/health", healthCheckHandler)
// Sends an email if the right things are specified
r.HandleFunc("/functions/sendmail", handleSendalert).Methods("POST", "OPTIONS")
r.HandleFunc("/functions/outlook/register", handleNewOutlookRegister).Methods("GET", "OPTIONS")
r.HandleFunc("/functions/outlook/getFolders", handleGetOutlookFolders).Methods("GET", "OPTIONS")
// Make user related locations
r.HandleFunc("/api/v1/users/generateapikey", handleApiGeneration).Methods("GET", "POST", "OPTIONS")
r.HandleFunc("/api/v1/users/login", handleLogin).Methods("POST", "OPTIONS")
+6 -10
View File
@@ -2042,16 +2042,14 @@ func cleanupExecutions(resp http.ResponseWriter, request *http.Request) {
return
}
//if user.Role != "admin" {
// resp.WriteHeader(401)
// resp.Write([]byte(`{"success": false, "message": "Insufficient permissions"}`))
// return
//}
log.Printf("CLEANUP!")
log.Printf("%#v", user)
if user.Role != "admin" {
resp.WriteHeader(401)
resp.Write([]byte(`{"success": false, "message": "Insufficient permissions"}`))
return
}
ctx := context.Background()
// Removes three months from today
timestamp := int64(time.Now().AddDate(0, -2, 0).Unix())
log.Println(timestamp)
@@ -2065,8 +2063,6 @@ func cleanupExecutions(resp http.ResponseWriter, request *http.Request) {
return
}
log.Println(len(workflowExecutions))
resp.WriteHeader(200)
resp.Write([]byte("OK"))
}