Fix some boolean issues

This commit is contained in:
Melon 2024-02-08 01:25:14 +00:00
parent b99fb9df6f
commit b47d4c8ad3
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
5 changed files with 7 additions and 7 deletions

View File

@ -67,7 +67,7 @@ func (h *HttpServer) OptionalAuthentication(next UserHandler) httprouter.Handle
http.Error(rw, err.Error(), http.StatusInternalServerError)
return
}
if auth.IsGuest() && !h.readLoginDataCookie(rw, req, &auth) {
if auth.IsGuest() && h.readLoginDataCookie(rw, req, &auth) {
return
}
next(rw, req, params, auth)

View File

@ -200,11 +200,11 @@ func (h *HttpServer) readLoginDataCookie(rw http.ResponseWriter, req *http.Reque
sessionData, done := h.fetchUserInfo(rw, err, sso, token)
if !done {
return false
return true
}
u.Data = sessionData
return true
return false
}
func (h *HttpServer) fetchUserInfo(rw http.ResponseWriter, err error, sso *issuer.WellKnownOIDC, token *oauth2.Token) (SessionData, bool) {

View File

@ -84,7 +84,7 @@ func (h *HttpServer) ManageAppsPost(rw http.ResponseWriter, req *http.Request, _
}) {
return
}
if HasRole(roles, "lavender:admin") {
if !HasRole(roles, "lavender:admin") {
http.Error(rw, "400 Bad Request: Only admin users can create SSO client applications", http.StatusBadRequest)
return
}

View File

@ -33,7 +33,7 @@ func (h *HttpServer) ManageUsersGet(rw http.ResponseWriter, req *http.Request, _
}) {
return
}
if HasRole(roles, "lavender:admin") {
if !HasRole(roles, "lavender:admin") {
http.Error(rw, "403 Forbidden", http.StatusForbidden)
return
}
@ -76,7 +76,7 @@ func (h *HttpServer) ManageUsersPost(rw http.ResponseWriter, req *http.Request,
}) {
return
}
if HasRole(roles, "lavender:admin") {
if !HasRole(roles, "lavender:admin") {
http.Error(rw, "400 Bad Request: Only admin users can manage users", http.StatusBadRequest)
return
}

View File

@ -7,7 +7,7 @@
let currentTokens = null;
const ssoService = "http://localhost:9090";
POP2.init(ssoService + "/authorize", "a", "openid profile", 500, 600);
POP2.init(ssoService + "/authorize", "f4cdb93d-fe28-427b-b037-f03f44c86a16", "openid profile", 500, 600);
function updateTokenInfo(data) {
currentTokens = data.tokens;