Fixed default environment name for action in workflow

This commit is contained in:
frikky
2020-05-12 17:20:48 +02:00
parent f8fac39308
commit 4748c0fab6
3 changed files with 50 additions and 45 deletions
+12 -14
View File
@@ -1775,6 +1775,7 @@ func handleExecution(id string, workflow Workflow, request *http.Request) (Workf
onpremExecution := false
environments := []string{}
for _, action := range workflowExecution.Workflow.Actions {
log.Printf("ENV: %#v", action.Environment)
if action.Environment != cloudname {
found := false
for _, env := range environments {
@@ -2414,16 +2415,21 @@ func deleteWorkflowApp(resp http.ResponseWriter, request *http.Request) {
// FIXME - check whether it's in use and maybe restrict again for later?
// FIXME - actually delete other than private apps too..
private := false
if app.Downloaded {
log.Printf("Deleting downloaded app (anyone can do this)")
log.Printf("Deleting downloaded app (authenticated users can do this)")
} else if user.Id != app.Owner && user.Role != "admin" {
log.Printf("Wrong user (%s) for app %s (delete)", user.Username, app.Name)
resp.WriteHeader(401)
resp.Write([]byte(`{"success": false}`))
return
} else {
private = true
}
// Not really deleting it, just removing from user cache
if private {
log.Printf("Deleting private app")
var privateApps []WorkflowApp
for _, item := range user.PrivateApps {
log.Println(item.ID, fileId)
@@ -2442,23 +2448,15 @@ func deleteWorkflowApp(resp http.ResponseWriter, request *http.Request) {
resp.Write([]byte(fmt.Sprintf(`{"success": true"}`)))
return
}
// Delete memcache for user
// Check cookie
c, err := request.Cookie("session_token")
} else {
log.Printf("Deleting public app")
err = DeleteKey(ctx, "workflowapp", fileId)
if err != nil {
log.Printf("User doesn't have sessiontoken on pw change: %s", err)
log.Printf("Failed deleting workflowapp")
resp.WriteHeader(401)
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "You're not logged in."}`)))
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "Failed deleting workflow app"}`)))
return
}
sessionToken := c.Value
session, err := getSession(ctx, sessionToken)
if err != nil {
log.Printf("Session %s doesn't exist: %s", session.Session, err)
resp.WriteHeader(401)
resp.Write([]byte(`{"success": false, "reason": "You're not logged in"}`))
return
}
//err = memcache.Delete(request.Context(), sessionToken)
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -38,10 +38,10 @@ import AlertTemplate from "react-alert-template-basic";
import { positions, Provider } from "react-alert";
// Testing - localhost
//const globalUrl = "http://192.168.3.6:5001"
const globalUrl = "http://192.168.3.6:5001"
// Production - backend proxy forwarding in nginx
const globalUrl = window.location.origin
//const globalUrl = window.location.origin
const surfaceColor = "#27292D"
const inputColor = "#383B40"