Bugfixes to admin panel, workflow view and app creator

This commit is contained in:
frikky
2021-04-18 20:48:11 +02:00
parent 033124b6ec
commit 00323689e2
8 changed files with 71 additions and 55 deletions
+9 -6
View File
@@ -1366,12 +1366,15 @@ func deleteWorkflow(resp http.ResponseWriter, request *http.Request) {
return
}
// FIXME - have a check for org etc too..
if user.Id != workflow.Owner {
log.Printf("Wrong user (%s) for workflow %s", user.Username, workflow.ID)
resp.WriteHeader(401)
resp.Write([]byte(`{"success": false}`))
return
if user.Id != workflow.Owner || len(user.Id) == 0 {
if workflow.OrgId == user.ActiveOrg.Id && user.Role == "admin" {
log.Printf("[INFO] User %s is deleting workflow %s as admin. Owner: %s", user.Username, workflow.ID, workflow.Owner)
} else {
log.Printf("Wrong user (%s) for workflow %s", user.Username, workflow.ID)
resp.WriteHeader(401)
resp.Write([]byte(`{"success": false}`))
return
}
}
// Clean up triggers and executions