Fixed authentication caching
This commit is contained in:
@@ -1362,7 +1362,6 @@ class AppBase:
|
|||||||
return str(baseresult)+str(appendresult), False
|
return str(baseresult)+str(appendresult), False
|
||||||
|
|
||||||
print("[INFO] After fourth parser return as JSON")
|
print("[INFO] After fourth parser return as JSON")
|
||||||
|
|
||||||
data, is_loop = recurse_json(basejson, parsersplit[1:])
|
data, is_loop = recurse_json(basejson, parsersplit[1:])
|
||||||
parseditem = data
|
parseditem = data
|
||||||
print("DATA: %s" % data)
|
print("DATA: %s" % data)
|
||||||
@@ -1405,12 +1404,23 @@ class AppBase:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Handles for loops etc.
|
# Handles for loops etc.
|
||||||
value, is_loop = get_json_value(fullexecution, to_be_replaced)
|
# FIXME: Should it dump to string here? Doesn't that defeat the purpose?
|
||||||
|
# Trying without string dumping.
|
||||||
|
|
||||||
|
value, is_loop = get_json_value(fullexecution, to_be_replaced)
|
||||||
|
print("\n\nType of value: %s. Value: %s" % (type(value), value))
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
parameter["value"] = parameter["value"].replace(to_be_replaced, value)
|
parameter["value"] = parameter["value"].replace(to_be_replaced, value)
|
||||||
elif isinstance(value, dict):
|
elif isinstance(value, dict) or isinstance(value, list):
|
||||||
|
# Changed from JSON dump to str() 28.05.2021
|
||||||
|
# This makes it so the parameters gets lists and dicts straight up
|
||||||
|
#parameter["value"] = parameter["value"].replace(to_be_replaced, json.dumps(value))
|
||||||
|
|
||||||
|
try:
|
||||||
|
parameter["value"] = parameter["value"].replace(to_be_replaced, str(value))
|
||||||
|
except:
|
||||||
parameter["value"] = parameter["value"].replace(to_be_replaced, json.dumps(value))
|
parameter["value"] = parameter["value"].replace(to_be_replaced, json.dumps(value))
|
||||||
|
print("Failed parsing value as string?")
|
||||||
else:
|
else:
|
||||||
print("Unknown type %s" % type(value))
|
print("Unknown type %s" % type(value))
|
||||||
try:
|
try:
|
||||||
@@ -1418,7 +1428,7 @@ class AppBase:
|
|||||||
except json.decoder.JSONDecodeError as e:
|
except json.decoder.JSONDecodeError as e:
|
||||||
parameter["value"] = parameter["value"].replace(to_be_replaced, value)
|
parameter["value"] = parameter["value"].replace(to_be_replaced, value)
|
||||||
|
|
||||||
print("VALUE: %s" % value)
|
print("VALUE: %s" % parameter["value"])
|
||||||
|
|
||||||
|
|
||||||
if parameter["variant"] == "WORKFLOW_VARIABLE":
|
if parameter["variant"] == "WORKFLOW_VARIABLE":
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
NAME=shuffle-app_sdk
|
NAME=shuffle-app_sdk
|
||||||
VERSION=0.8.90
|
VERSION=0.8.95
|
||||||
|
|
||||||
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
|
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
|
||||||
docker build . -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION
|
docker build . -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION
|
||||||
|
|||||||
@@ -5552,9 +5552,9 @@ func makeWorkflowPublic(resp http.ResponseWriter, request *http.Request) {
|
|||||||
// Check workflow.Sharing == private / public / org too
|
// Check workflow.Sharing == private / public / org too
|
||||||
if user.Id != workflow.Owner || len(user.Id) == 0 {
|
if user.Id != workflow.Owner || len(user.Id) == 0 {
|
||||||
if workflow.OrgId == user.ActiveOrg.Id && user.Role == "admin" {
|
if workflow.OrgId == user.ActiveOrg.Id && user.Role == "admin" {
|
||||||
log.Printf("[INFO] User %s is accessing workflow %s as admin", user.Username, workflow.ID)
|
log.Printf("[AUDIT] User %s is accessing workflow %s as admin (public)", user.Username, workflow.ID)
|
||||||
} else {
|
} else {
|
||||||
log.Printf("[WARNING] Wrong user (%s) for workflow %s (get workflow)", user.Username, workflow.ID)
|
log.Printf("[WARNING] Wrong user (%s) for workflow %s (public)", user.Username, workflow.ID)
|
||||||
resp.WriteHeader(401)
|
resp.WriteHeader(401)
|
||||||
resp.Write([]byte(`{"success": false}`))
|
resp.Write([]byte(`{"success": false}`))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ services:
|
|||||||
- 9200:9200
|
- 9200:9200
|
||||||
networks:
|
networks:
|
||||||
- shuffle
|
- shuffle
|
||||||
|
restart: unless-stopped
|
||||||
# OLD DATABASE:
|
# OLD DATABASE:
|
||||||
#database:
|
#database:
|
||||||
# #build: ./backend/database
|
# #build: ./backend/database
|
||||||
|
|||||||
@@ -112,16 +112,28 @@ const ParsedAction = (props) => {
|
|||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.then((responseJson) => {
|
.then((responseJson) => {
|
||||||
if (setApp && responseJson.actions !== undefined && responseJson.actions !== null) {
|
console.log("RESPONSE: ", responseJson)
|
||||||
|
|
||||||
|
const parsedapp = responseJson.app !== undefined && responseJson.app !== null ? JSON.parse(atob(responseJson.app)) : {}
|
||||||
|
console.log("PARSED: ", parsedapp)
|
||||||
|
//data = parsedapp.body === undefined ? parsedapp : parsedapp.body
|
||||||
|
|
||||||
|
if (setApp && parsedapp.actions !== undefined && parsedapp.actions !== null) {
|
||||||
|
console.log("Inside first if")
|
||||||
if (selectedApp.versions !== undefined && selectedApp.versions !== null) {
|
if (selectedApp.versions !== undefined && selectedApp.versions !== null) {
|
||||||
responseJson.versions = selectedApp.versions
|
parsedapp.versions = selectedApp.versions
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedApp.loop_versions !== undefined && selectedApp.loop_versions !== null) {
|
if (selectedApp.loop_versions !== undefined && selectedApp.loop_versions !== null) {
|
||||||
responseJson.loop_versions = selectedApp.loop_versions
|
parsedapp.loop_versions = selectedApp.loop_versions
|
||||||
}
|
}
|
||||||
|
|
||||||
var foundAction = responseJson.actions.find(action => action.name.toLowerCase() === selectedAction.name.toLowerCase())
|
// Find authentication, and if it works?
|
||||||
|
// If authentication has less OR more fields, it has to change
|
||||||
|
//console.log(selected
|
||||||
|
|
||||||
|
console.log("Inside first if2")
|
||||||
|
var foundAction = parsedapp.actions.find(action => action.name.toLowerCase() === selectedAction.name.toLowerCase())
|
||||||
console.log("FOUNDACTION: ", foundAction)
|
console.log("FOUNDACTION: ", foundAction)
|
||||||
if (foundAction !== null && foundAction !== undefined) {
|
if (foundAction !== null && foundAction !== undefined) {
|
||||||
var foundparams = []
|
var foundparams = []
|
||||||
@@ -134,20 +146,23 @@ const ParsedAction = (props) => {
|
|||||||
} else {
|
} else {
|
||||||
foundAction.parameters[paramkey] = foundParam
|
foundAction.parameters[paramkey] = foundParam
|
||||||
}
|
}
|
||||||
|
|
||||||
//foundparams.push(param.name)
|
//foundparams.push(param.name)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alert.error("Couldn't find action "+selectedAction.name)
|
alert.error("Couldn't find action "+selectedAction.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
selectedAction.errors = []
|
||||||
|
selectedAction.is_valid = true
|
||||||
|
|
||||||
// Updating params for the new action
|
// Updating params for the new action
|
||||||
selectedAction.parameters = foundAction.parameters
|
selectedAction.parameters = foundAction.parameters
|
||||||
selectedAction.app_id = appId
|
selectedAction.app_id = appId
|
||||||
selectedAction.app_version = responseJson.app_version
|
selectedAction.app_version = parsedapp.app_version
|
||||||
|
|
||||||
setSelectedAction(selectedAction)
|
setSelectedAction(selectedAction)
|
||||||
setSelectedApp(responseJson)
|
setSelectedApp(parsedapp)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@@ -665,6 +680,9 @@ const ParsedAction = (props) => {
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
style={{backgroundColor: theme.palette.inputColor, borderRadius: theme.palette.borderRadius,}}
|
style={{backgroundColor: theme.palette.inputColor, borderRadius: theme.palette.borderRadius,}}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
|
classes: {
|
||||||
|
notchedOutline: classes.notchedOutline,
|
||||||
|
},
|
||||||
style:{
|
style:{
|
||||||
color: "white",
|
color: "white",
|
||||||
minHeight: 50,
|
minHeight: 50,
|
||||||
@@ -1273,6 +1291,7 @@ const ParsedAction = (props) => {
|
|||||||
defaultValue={selectedAction.app_version}
|
defaultValue={selectedAction.app_version}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
const newversion = selectedApp.versions.find(tmpApp => tmpApp.version == event.target.value)
|
const newversion = selectedApp.versions.find(tmpApp => tmpApp.version == event.target.value)
|
||||||
|
console.log("NEWVERSION: ", newversion)
|
||||||
if (newversion !== undefined && newversion !== null) {
|
if (newversion !== undefined && newversion !== null) {
|
||||||
getApp(newversion.id, true)
|
getApp(newversion.id, true)
|
||||||
}
|
}
|
||||||
@@ -1303,6 +1322,9 @@ const ParsedAction = (props) => {
|
|||||||
<TextField
|
<TextField
|
||||||
style={theme.palette.textFieldStyle}
|
style={theme.palette.textFieldStyle}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
|
classes: {
|
||||||
|
notchedOutline: classes.notchedOutline,
|
||||||
|
},
|
||||||
style: theme.palette.innerTextfieldStyle,
|
style: theme.palette.innerTextfieldStyle,
|
||||||
}}
|
}}
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
@@ -151,7 +151,10 @@ const Admin = (props) => {
|
|||||||
if (responseJson["success"] === false) {
|
if (responseJson["success"] === false) {
|
||||||
alert.error("Failed deleting auth")
|
alert.error("Failed deleting auth")
|
||||||
} else {
|
} else {
|
||||||
|
// Need to wait because query in ES is too fast
|
||||||
|
setTimeout(() => {
|
||||||
getAppAuthentication()
|
getAppAuthentication()
|
||||||
|
}, 1000);
|
||||||
alert.success("Successfully deleted authentication!")
|
alert.success("Successfully deleted authentication!")
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1585,7 +1585,7 @@ const AngularWorkflow = (props) => {
|
|||||||
const onNodeSelect = (event, newAppAuth) => {
|
const onNodeSelect = (event, newAppAuth) => {
|
||||||
const data = event.target.data()
|
const data = event.target.data()
|
||||||
if (data.isButton) {
|
if (data.isButton) {
|
||||||
console.log("BUTTON CLICKED: ", data)
|
//console.log("BUTTON CLICKED: ", data)
|
||||||
if (data.buttonType === "delete") {
|
if (data.buttonType === "delete") {
|
||||||
console.log("DELETE!")
|
console.log("DELETE!")
|
||||||
const parentNode = cy.getElementById(data.attachedTo)
|
const parentNode = cy.getElementById(data.attachedTo)
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export const GetIconInfo = (action) => {
|
|||||||
{"key": "execute", "values": ["execute", "run", "play", "raise",]},
|
{"key": "execute", "values": ["execute", "run", "play", "raise",]},
|
||||||
{"key": "extract", "values": ["extract", "unpack", "decompress"]},
|
{"key": "extract", "values": ["extract", "unpack", "decompress"]},
|
||||||
{"key": "inflate", "values": ["inflate", "pack", "compress",]},
|
{"key": "inflate", "values": ["inflate", "pack", "compress",]},
|
||||||
{"key": "edit", "values": ["update", "create", "edit", "put", "patch", "change", "parse", "replace", "filter", "conver", "map"]},
|
{"key": "edit", "values": ["update", "create", "edit", "put", "patch", "change", "parse", "replace", "filter", "conver", "map", "format", "escape"]},
|
||||||
{"key": "compare", "values": ["compare", "convert", "to", "filter", "translate", ]},
|
{"key": "compare", "values": ["compare", "convert", "to", "filter", "translate", ]},
|
||||||
{"key": "list", "values": ["list", "head", "options"]},
|
{"key": "list", "values": ["list", "head", "options"]},
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user