feat(dataservices): unify access methods and abstract away redundant code [EE-5628] (#9115)
This commit is contained in:
@@ -134,7 +134,7 @@ func (bouncer *RequestBouncer) AuthorizedEndpointOperation(r *http.Request, endp
|
||||
return err
|
||||
}
|
||||
|
||||
group, err := bouncer.dataStore.EndpointGroup().EndpointGroup(endpoint.GroupID)
|
||||
group, err := bouncer.dataStore.EndpointGroup().Read(endpoint.GroupID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -217,7 +217,7 @@ func (bouncer *RequestBouncer) mwCheckPortainerAuthorizations(next http.Handler,
|
||||
return
|
||||
}
|
||||
|
||||
_, err = bouncer.dataStore.User().User(tokenData.ID)
|
||||
_, err = bouncer.dataStore.User().Read(tokenData.ID)
|
||||
if bouncer.dataStore.IsErrObjectNotFound(err) {
|
||||
httperror.WriteError(w, http.StatusUnauthorized, "Unauthorized", httperrors.ErrUnauthorized)
|
||||
return
|
||||
@@ -288,7 +288,7 @@ func (bouncer *RequestBouncer) mwAuthenticateFirst(tokenLookups []tokenLookup, n
|
||||
return
|
||||
}
|
||||
|
||||
_, err := bouncer.dataStore.User().User(token.ID)
|
||||
_, err := bouncer.dataStore.User().Read(token.ID)
|
||||
if err != nil && bouncer.dataStore.IsErrObjectNotFound(err) {
|
||||
httperror.WriteError(w, http.StatusUnauthorized, "Unauthorized", httperrors.ErrUnauthorized)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user