#168: Added dummy auths to make it simpler to import new workflows
This commit is contained in:
@@ -7536,16 +7536,16 @@ func runInit(ctx context.Context) {
|
||||
if err != nil {
|
||||
log.Printf("Failed to upload workflows from github: %s", err)
|
||||
} else {
|
||||
log.Printf("Finished downloading workflows from github!")
|
||||
log.Printf("[INFO] Finished downloading workflows from github!")
|
||||
}
|
||||
} else {
|
||||
log.Printf("Skipping because there are %d workflows already", len(workflows))
|
||||
log.Printf("[INFO] Skipping because there are %d workflows already", len(workflows))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("Finished INIT")
|
||||
log.Printf("[INFO] Finished INIT")
|
||||
}
|
||||
|
||||
func handleVerifyCloudsync(orgId string) (SyncFeatures, error) {
|
||||
|
||||
@@ -140,6 +140,7 @@ type AppAuthenticationStorage struct {
|
||||
OrgId string `json:"org_id" datastore:"org_id"`
|
||||
Created int64 `json:"created" datastore:"created"`
|
||||
Edited int64 `json:"edited" datastore:"edited"`
|
||||
Defined bool `json:"defined" datastore:"defined"`
|
||||
}
|
||||
|
||||
type AuthenticationUsage struct {
|
||||
@@ -2220,6 +2221,10 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) {
|
||||
continue
|
||||
}
|
||||
|
||||
if !auth.Defined {
|
||||
continue
|
||||
}
|
||||
|
||||
if auth.App.Name == action.AppName {
|
||||
//log.Printf("FOUND AUTH FOR APP %s: %s", auth.App.Name, auth.Id)
|
||||
action.AuthenticationId = auth.Id
|
||||
@@ -2228,6 +2233,7 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Only o this IF there isn't another one for the app already
|
||||
if !authSet {
|
||||
//log.Printf("Validate if the app NEEDS auth or not")
|
||||
outerapp := WorkflowApp{}
|
||||
@@ -2239,9 +2245,45 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
if len(outerapp.ID) > 0 && outerapp.Authentication.Required {
|
||||
// FIXME: Add app auth
|
||||
found := false
|
||||
for _, auth := range allAuths {
|
||||
if auth.App.ID == outerapp.ID {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Add app auth
|
||||
if !found {
|
||||
timeNow := int64(time.Now().Unix())
|
||||
authFields := []AuthenticationStore{}
|
||||
for _, param := range outerapp.Authentication.Parameters {
|
||||
authFields = append(authFields, AuthenticationStore{
|
||||
Key: param.Name,
|
||||
Value: "",
|
||||
})
|
||||
}
|
||||
|
||||
appAuth := AppAuthenticationStorage{
|
||||
Active: true,
|
||||
Label: fmt.Sprintf("default_%s", outerapp.Name),
|
||||
Id: uuid.NewV4().String(),
|
||||
App: outerapp,
|
||||
Fields: authFields,
|
||||
Usage: []AuthenticationUsage{},
|
||||
WorkflowCount: 0,
|
||||
NodeCount: 0,
|
||||
OrgId: user.ActiveOrg.Id,
|
||||
Created: timeNow,
|
||||
Edited: timeNow,
|
||||
}
|
||||
|
||||
err = setWorkflowAppAuthDatastore(ctx, appAuth, appAuth.Id)
|
||||
if err != nil {
|
||||
log.Printf("Failed setting appauth for with name %s", appAuth.Label)
|
||||
}
|
||||
}
|
||||
|
||||
//log.Printf("FOUND APP TO VALIDATE: %#v", outerapp)
|
||||
action.Errors = append(action.Errors, "Requires authentication")
|
||||
action.IsValid = false
|
||||
workflow.IsValid = false
|
||||
@@ -2259,7 +2301,7 @@ func saveWorkflow(resp http.ResponseWriter, request *http.Request) {
|
||||
newActions = actionFixing
|
||||
}
|
||||
|
||||
workflow.PreviouslySaved = true
|
||||
//workflow.PreviouslySaved = true
|
||||
}
|
||||
//PreviouslySaved bool `json:"first_save" datastore:"first_save"`
|
||||
|
||||
@@ -4616,7 +4658,6 @@ func getWorkflowAppConfig(resp http.ResponseWriter, request *http.Request) {
|
||||
resp.Write(data)
|
||||
}
|
||||
|
||||
//r.HandleFunc("/api/v1/apps/authentication/{appauthId}/config", setAuthenticationConfig).Methods("POST", "OPTIONS")
|
||||
func setAuthenticationConfig(resp http.ResponseWriter, request *http.Request) {
|
||||
cors := handleCors(resp, request)
|
||||
if cors {
|
||||
@@ -4649,7 +4690,6 @@ func setAuthenticationConfig(resp http.ResponseWriter, request *http.Request) {
|
||||
|
||||
fileId = location[5]
|
||||
}
|
||||
log.Printf("FILE: %s", fileId)
|
||||
|
||||
body, err := ioutil.ReadAll(request.Body)
|
||||
if err != nil {
|
||||
@@ -4679,7 +4719,6 @@ func setAuthenticationConfig(resp http.ResponseWriter, request *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("body: %s", string(body))
|
||||
ctx := context.Background()
|
||||
auth, err := getWorkflowAppAuthDatastore(ctx, fileId)
|
||||
if err != nil {
|
||||
@@ -4868,6 +4907,7 @@ func addAppAuthentication(resp http.ResponseWriter, request *http.Request) {
|
||||
|
||||
//appAuth.LargeImage = ""
|
||||
appAuth.OrgId = user.ActiveOrg.Id
|
||||
appAuth.Defined = true
|
||||
err = setWorkflowAppAuthDatastore(ctx, appAuth, appAuth.Id)
|
||||
if err != nil {
|
||||
log.Printf("Failed setting up app auth %s: %s", appAuth.Id, err)
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
version: '3'
|
||||
services:
|
||||
frontend:
|
||||
#build: ./frontend
|
||||
image: ghcr.io/frikky/shuffle-frontend:0.8.51
|
||||
build: ./frontend
|
||||
image: ghcr.io/frikky/shuffle-frontend:0.8.53
|
||||
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.52
|
||||
image: ghcr.io/frikky/shuffle-backend:0.8.53
|
||||
container_name: shuffle-backend
|
||||
hostname: ${BACKEND_HOSTNAME}
|
||||
# Here for debugging:
|
||||
|
||||
Generated
+927
-116
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "shuffler",
|
||||
"homepage": "https://shuffler.io",
|
||||
"version": "0.8.3",
|
||||
"version": "0.8.53",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@material-ui/core": "^4.5.2",
|
||||
"@material-ui/icons": "^4.5.1",
|
||||
"@material-ui/styles": "^4.5.2",
|
||||
"@use-it/interval": "^0.1.3",
|
||||
"@use-it/interval": "^1.0.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"class-transformer": "^0.3.1",
|
||||
"create-react-app": "^2.0.3",
|
||||
@@ -32,7 +32,7 @@
|
||||
"md5-file": "^4.0.0",
|
||||
"mdbreact": "^4.21.1",
|
||||
"moment": "~2.20.1",
|
||||
"react": "^16.10.2",
|
||||
"react": "^17.0.1",
|
||||
"react-alert": "^5.5.0",
|
||||
"react-alert-template-basic": "^1.0.0",
|
||||
"react-beforeunload": "^2.2.1",
|
||||
@@ -40,7 +40,7 @@
|
||||
"react-cookie": "^4.0.1",
|
||||
"react-cytoscapejs": "^1.2.0",
|
||||
"react-device-detect": "^1.9.10",
|
||||
"react-dom": "^16.10.2",
|
||||
"react-dom": "^17.0.1",
|
||||
"react-draggable": "^3.3.2",
|
||||
"react-dropzone": "^10.1.10",
|
||||
"react-ga": "^2.7.0",
|
||||
|
||||
Reference in New Issue
Block a user