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 onpremExecution := false
environments := []string{} environments := []string{}
for _, action := range workflowExecution.Workflow.Actions { for _, action := range workflowExecution.Workflow.Actions {
log.Printf("ENV: %#v", action.Environment)
if action.Environment != cloudname { if action.Environment != cloudname {
found := false found := false
for _, env := range environments { 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 - check whether it's in use and maybe restrict again for later?
// FIXME - actually delete other than private apps too.. // FIXME - actually delete other than private apps too..
private := false
if app.Downloaded { 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" { } else if user.Id != app.Owner && user.Role != "admin" {
log.Printf("Wrong user (%s) for app %s (delete)", user.Username, app.Name) log.Printf("Wrong user (%s) for app %s (delete)", user.Username, app.Name)
resp.WriteHeader(401) resp.WriteHeader(401)
resp.Write([]byte(`{"success": false}`)) resp.Write([]byte(`{"success": false}`))
return return
} else {
private = true
} }
// Not really deleting it, just removing from user cache // Not really deleting it, just removing from user cache
if private {
log.Printf("Deleting private app")
var privateApps []WorkflowApp var privateApps []WorkflowApp
for _, item := range user.PrivateApps { for _, item := range user.PrivateApps {
log.Println(item.ID, fileId) log.Println(item.ID, fileId)
@@ -2442,23 +2448,15 @@ func deleteWorkflowApp(resp http.ResponseWriter, request *http.Request) {
resp.Write([]byte(fmt.Sprintf(`{"success": true"}`))) resp.Write([]byte(fmt.Sprintf(`{"success": true"}`)))
return return
} }
} else {
// Delete memcache for user log.Printf("Deleting public app")
// Check cookie err = DeleteKey(ctx, "workflowapp", fileId)
c, err := request.Cookie("session_token")
if err != nil { if err != nil {
log.Printf("User doesn't have sessiontoken on pw change: %s", err) log.Printf("Failed deleting workflowapp")
resp.WriteHeader(401) 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 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) //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"; import { positions, Provider } from "react-alert";
// Testing - localhost // Testing - localhost
//const globalUrl = "http://192.168.3.6:5001" const globalUrl = "http://192.168.3.6:5001"
// Production - backend proxy forwarding in nginx // Production - backend proxy forwarding in nginx
const globalUrl = window.location.origin //const globalUrl = window.location.origin
const surfaceColor = "#27292D" const surfaceColor = "#27292D"
const inputColor = "#383B40" const inputColor = "#383B40"