move registry struct definitions to dataservice/registry
Signed-off-by: Sven Dowideit <sven.dowideit@portainer.io>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package users
|
||||
|
||||
import (
|
||||
"github.com/portainer/portainer/api/database"
|
||||
"net/http"
|
||||
|
||||
httperror "github.com/portainer/libhttp/error"
|
||||
@@ -43,11 +44,11 @@ func (handler *Handler) userRemoveAccessToken(w http.ResponseWriter, r *http.Req
|
||||
if err != nil {
|
||||
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve user authentication token", err}
|
||||
}
|
||||
if tokenData.Role != portainer.AdministratorRole && tokenData.ID != portainer.UserID(userID) {
|
||||
if tokenData.Role != portainer.AdministratorRole && tokenData.ID != database.UserID(userID) {
|
||||
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to get user access tokens", httperrors.ErrUnauthorized}
|
||||
}
|
||||
|
||||
_, err = handler.DataStore.User().User(portainer.UserID(userID))
|
||||
_, err = handler.DataStore.User().User(database.UserID(userID))
|
||||
if err != nil {
|
||||
if handler.DataStore.IsErrObjectNotFound(err) {
|
||||
return &httperror.HandlerError{http.StatusNotFound, "Unable to find a user with the specified identifier inside the database", err}
|
||||
@@ -60,7 +61,7 @@ func (handler *Handler) userRemoveAccessToken(w http.ResponseWriter, r *http.Req
|
||||
if err != nil {
|
||||
return &httperror.HandlerError{http.StatusInternalServerError, "API Key not found", err}
|
||||
}
|
||||
if apiKey.UserID != portainer.UserID(userID) {
|
||||
if apiKey.UserID != database.UserID(userID) {
|
||||
return &httperror.HandlerError{http.StatusForbidden, "Permission denied to remove api-key", httperrors.ErrUnauthorized}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user