1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 07:49:41 +02:00

chore(nil): remove unnecessary nil checks EE-4847 (#8254)

This commit is contained in:
andres-portainer 2022-12-30 15:26:46 -03:00 committed by GitHub
parent e529327851
commit 137ce37096
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 18 deletions

View file

@ -81,9 +81,9 @@ func (bouncer *RequestBouncer) RestrictedAccess(h http.Handler) http.Handler {
// TeamLeaderAccess defines a security check for APIs require team leader privilege
//
// Bouncer operations are applied backwards:
// - Parse the JWT from the request and stored in context, user has to be authenticated
// - Upgrade to the restricted request
// - User is admin or team leader
// - Parse the JWT from the request and stored in context, user has to be authenticated
// - Upgrade to the restricted request
// - User is admin or team leader
func (bouncer *RequestBouncer) TeamLeaderAccess(h http.Handler) http.Handler {
h = bouncer.mwIsTeamLeader(h)
h = bouncer.mwUpgradeToRestrictedRequest(h)
@ -199,7 +199,7 @@ func (bouncer *RequestBouncer) mwCheckPortainerAuthorizations(next http.Handler,
}
_, err = bouncer.dataStore.User().User(tokenData.ID)
if err != nil && bouncer.dataStore.IsErrObjectNotFound(err) {
if bouncer.dataStore.IsErrObjectNotFound(err) {
httperror.WriteError(w, http.StatusUnauthorized, "Unauthorized", httperrors.ErrUnauthorized)
return
} else if err != nil {