mirror of
https://github.com/1f349/lavender.git
synced 2024-11-09 22:32:48 +00:00
Fix some boolean issues
This commit is contained in:
parent
b99fb9df6f
commit
b47d4c8ad3
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user