Skip to content

Commit

Permalink
Fixed app auth loading
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed Apr 30, 2024
1 parent 899e218 commit 92a6af5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 30 deletions.
17 changes: 17 additions & 0 deletions db-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -5489,6 +5489,10 @@ func GetPrioritizedApps(ctx context.Context, user User) ([]WorkflowApp, error) {
}
}
}

if app.Authentication.Type == "oauth2-app" && len(app.Authentication.RedirectUri) > 0 {
allApps[appIndex].Authentication.Type = "oauth2"
}
}

return allApps, nil
Expand Down Expand Up @@ -5988,6 +5992,17 @@ func GetPrioritizedApps(ctx context.Context, user User) ([]WorkflowApp, error) {
return allApps[i].Edited > allApps[j].Edited
})

// Fix Oauth2 issues
for appIndex, app := range allApps {
if app.Authentication.Type != "oauth2-app" {
continue
}

if len(app.Authentication.RedirectUri) > 0 {
allApps[appIndex].Authentication.Type = "oauth2"
}
}

if len(allApps) > 0 {
// Finds references
allApps = findReferenceAppDocs(ctx, allApps)
Expand All @@ -6005,6 +6020,8 @@ func GetPrioritizedApps(ctx context.Context, user User) ([]WorkflowApp, error) {
}
}



return allApps, nil
}

Expand Down
30 changes: 0 additions & 30 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,36 +64,6 @@ type AllPipelinesWrapper struct {
} `json:"hits"`
}

type Pipeline struct {
Name string `json:"name"`
Type string `json:"type"`
Command string `json:"command"`
Environment string `json:"environment"`
WorkflowId string `json:"workflow_id"`
StartNode string `json:"start_node"`
OrgId string `json:"org_id"`
Status string `json:"status"`
Error string `json:"error"`

PipelineId string `json:"pipeline_id"`
TriggerId string `json:"trigger_id"`
}

type AllPipelinesWrapper struct {
Hits struct {
Total struct {
Value int `json:"value"`
Relation string `json:"relation"`
} `json:"total"`
Hits []struct {
Index string `json:"_index"`
ID string `json:"_id"`
Score float64 `json:"_score"`
Source Pipeline `json:"_source"`
} `json:"hits"`
} `json:"hits"`
}

type QueryInput struct {
// Required
Query string `json:"query"`
Expand Down

0 comments on commit 92a6af5

Please sign in to comment.