diff --git a/.env b/.env index ac31f93a..1b646f6f 100644 --- a/.env +++ b/.env @@ -31,7 +31,7 @@ FRONTEND_PORT=3001 FRONTEND_PORT_HTTPS=3443 # CHANGE THIS IF YOU WANT GOOD LOCAL EXECUTIONS: OUTER_HOSTNAME=shuffle-backend -DB_LOCATION=./shuffle-database-new +DB_LOCATION=./shuffle-database # Proxy configurations. SHUFFLE_PASS_WORKER_PROXY must be FALSE to not pass the proxy information to sub-apps. # PS: It will skip proxy for diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index c654792d..eced0ea8 100644 --- a/backend/go-app/go.mod +++ b/backend/go-app/go.mod @@ -20,7 +20,7 @@ require ( github.com/docker/go-connections v0.4.0 github.com/docker/go-units v0.4.0 // indirect github.com/frikky/kin-openapi v0.38.0 - github.com/frikky/shuffle-shared v0.0.28 + github.com/frikky/shuffle-shared v0.0.32 github.com/ghodss/yaml v1.0.0 github.com/go-git/go-billy/v5 v5.0.0 github.com/go-git/go-git/v5 v5.0.0 diff --git a/backend/go-app/go.sum b/backend/go-app/go.sum index 5890f5e5..7e5d3932 100644 --- a/backend/go-app/go.sum +++ b/backend/go-app/go.sum @@ -104,6 +104,8 @@ github.com/frikky/shuffle-shared v0.0.27 h1:BbibbAv3a5GWR/DfaoSC4D9+fh2cwSEvn9H+ github.com/frikky/shuffle-shared v0.0.27/go.mod h1:H7SqOta/EAYnfYuWzwzYSh/oWfF0kgnuaJTQNKQBvoQ= github.com/frikky/shuffle-shared v0.0.28 h1:VQqL3+ePwKSUxCOiCC8DpOEgbb2GhXI8XzFB/YlHbps= github.com/frikky/shuffle-shared v0.0.28/go.mod h1:H7SqOta/EAYnfYuWzwzYSh/oWfF0kgnuaJTQNKQBvoQ= +github.com/frikky/shuffle-shared v0.0.32 h1:Uy/zcAetSVYtRr3HEkUb7aE7Ggm0oSFxVeUNsi6q4uc= +github.com/frikky/shuffle-shared v0.0.32/go.mod h1:H7SqOta/EAYnfYuWzwzYSh/oWfF0kgnuaJTQNKQBvoQ= github.com/getkin/kin-openapi v0.8.0 h1:a6TQjTqwkyscC4/hShJX7WhCVE+4bi9lzw61XHQW5hE= github.com/getkin/kin-openapi v0.8.0/go.mod h1:zZQMFkVgRHCdhgb6ihCTIo9dyDZFvX0k/xAKqw1FhPw= github.com/getkin/kin-openapi v0.52.0 h1:6WqsF5d6PfJ8AscdD+9Rtb2RP2iBWyC7V6GcjssWg7M= diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 83ca6c12..ef777845 100644 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index b2de1a33..55f7a079 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: frontend: #build: ./frontend - image: ghcr.io/frikky/shuffle-frontend:0.8.73 + image: ghcr.io/frikky/shuffle-frontend:0.8.74 container_name: shuffle-frontend hostname: shuffle-frontend ports: @@ -17,7 +17,7 @@ services: - backend backend: #build: ./backend - image: ghcr.io/frikky/shuffle-backend:0.8.73 + image: ghcr.io/frikky/shuffle-backend:0.8.74 container_name: shuffle-backend hostname: ${BACKEND_HOSTNAME} # Here for debugging: diff --git a/frontend/src/views/Admin.jsx b/frontend/src/views/Admin.jsx index 20a13eda..60d7bb3b 100644 --- a/frontend/src/views/Admin.jsx +++ b/frontend/src/views/Admin.jsx @@ -373,7 +373,11 @@ const Admin = (props) => { .then(response => response.json().then(responseJson => { if (responseJson["success"] === false) { - alert.error("Failed setting new password") + if (responseJson.reason !== undefined) { + alert.error(responseJson.reason) + } else { + alert.error("Failed setting new password") + } } else { alert.success("Successfully updated password!") setSelectedUserModalOpen(false) @@ -387,7 +391,7 @@ const Admin = (props) => { const deleteUser = (data) => { // Just use this one? - const userId = isCloud ? data.username : data.id + const userId = data.id const url = globalUrl + '/api/v1/users/' + userId fetch(url, { @@ -1076,7 +1080,6 @@ const Admin = (props) => { const setUser = (userId, field, value) => { const data = { "user_id": userId } data[field] = value - console.log("DATA: ", data) fetch(globalUrl + "/api/v1/users/updateuser", { method: 'PUT', @@ -1238,37 +1241,41 @@ const Admin = (props) => { }, }} > - Edit user + Editing {selectedUser.username} -
- setNewPassword(e.target.value)} - /> - -
+ {isCloud ? + null + : +
+ setNewPassword(e.target.value)} + /> + +
+ }