Skip to content

Commit

Permalink
Merge pull request #93 from Klaven/dashboard-api
Browse files Browse the repository at this point in the history
updated building
  • Loading branch information
MarekCounts authored Mar 20, 2024
2 parents 7d3945b + 43b8540 commit f67a9d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/update-dev-manifets.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: deploy-dev-manifests

on:
push:
branches:
- 'main'
workflow_dispatch:
workflow_run:
workflows: ["build-api", "build-container-builder", "build-null-operator"]
types:
- completed

jobs:
build-manifests:
Expand Down
7 changes: 3 additions & 4 deletions api/middleware/dumbauthz.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func (k *AuthzMiddleware) CheckAuthz(next http.Handler) http.Handler {
// Check if the user-id header is set
userId, ok := r.Context().Value("user-id").(string)
if !ok {
fmt.Println("User is new, redirecting to new user page")
http.Error(w, "User is new, redirecting to new user page", http.StatusTemporaryRedirect)
fmt.Println("User is new")
http.Error(w, "User is new, they need to ", http.StatusBadRequest)
w.Header().Set("location", "/newuser")
return
}
Expand All @@ -34,8 +34,7 @@ func (k *AuthzMiddleware) CheckAuthz(next http.Handler) http.Handler {
_, err := user.GetUserForId(userId, k.db)

if err != nil {
fmt.Println("User is new, redirecting to new user page")
http.Error(w, "User is new, redirecting to new user page", http.StatusTemporaryRedirect)
http.Error(w, "User is new, please register user", http.StatusBadRequest)
w.Header().Set("location", "/newuser")
return
}
Expand Down
3 changes: 1 addition & 2 deletions api/middleware/newuser.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ func (k *UserMiddleware) NewUserMiddlewareCheck(next http.Handler) http.Handler
_, err := user.GetUserForId(userId, k.db)

if err != nil {
fmt.Println("User is new, redirecting to new user page")
http.Error(w, "User is new, redirecting to new user page", http.StatusTemporaryRedirect)
http.Error(w, "User is new, please register user", http.StatusBadRequest)
w.Header().Set("location", "/newuser")
return
}
Expand Down

0 comments on commit f67a9d6

Please sign in to comment.