Skip to content

Commit

Permalink
Upgrade Session to Project even without account (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
klaidliadon authored Nov 20, 2024
1 parent 56e5123 commit 22f2acb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ func Session(cfg Options) func(next http.Handler) http.Handler {

if user != nil {
ctx = WithUser(ctx, user)

sessionType = proto.SessionType_User
if isAdmin {
sessionType = proto.SessionType_Admin
Expand All @@ -196,11 +195,11 @@ func Session(cfg Options) func(next http.Handler) http.Handler {
if adminClaim {
sessionType = proto.SessionType_Admin
}
}

if projectClaim > 0 {
ctx = WithProjectID(ctx, uint64(projectClaim))
sessionType = proto.SessionType_Project
}
if projectClaim > 0 {
ctx = WithProjectID(ctx, uint64(projectClaim))
sessionType = max(sessionType, proto.SessionType_Project)
}
}

Expand Down

0 comments on commit 22f2acb

Please sign in to comment.