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:
parent
e529327851
commit
137ce37096
8 changed files with 15 additions and 18 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue