File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -7731,9 +7731,25 @@ func SaveWorkflow(resp http.ResponseWriter, request *http.Request) {
77317731 log.Printf("[AUDIT] Letting verified support admin %s access workflow %s (save workflow)", user.Username, workflow.ID)
77327732
77337733 workflow.ID = tmpworkflow.ID
7734+
77347735 } else if tmpworkflow.OrgId == user.ActiveOrg.Id && user.Role != "org-reader" {
77357736 log.Printf("[AUDIT] User %s is accessing workflow %s (save workflow)", user.Username, tmpworkflow.ID)
77367737 workflow.ID = tmpworkflow.ID
7738+ } else if ArrayContains(user.Orgs, tmpworkflow.OrgId) {
7739+ tmpWorkflowOrg, err := GetOrg(ctx, tmpworkflow.OrgId)
7740+ if err != nil {
7741+ log.Printf("[WARNING] Failed getting org for workflow %s: %s", tmpworkflow.OrgId, err)
7742+ resp.WriteHeader(401)
7743+ resp.Write([]byte(`{"success": false}`))
7744+ return
7745+ }
7746+
7747+ for _, User := range tmpWorkflowOrg.Users {
7748+ if user.Id == User.Id && User.Role != "org-reader" {
7749+ log.Printf("[AUDIT] (1) User %s is accessing workflow %s (save workflow)", user.Username, tmpworkflow.ID)
7750+ workflow.ID = tmpworkflow.ID
7751+ }
7752+ }
77377753 } else {
77387754 log.Printf("[AUDIT] Wrong user (%s) for workflow %s (save)", user.Username, tmpworkflow.ID)
77397755 resp.WriteHeader(401)
You can’t perform that action at this time.
0 commit comments