mirror of
https://github.com/rancher/steve.git
synced 2025-07-19 09:17:07 +00:00
cleanup: remove duplicate apiserver import
Remove duplicate import and make aliasing of other apiserver imports consistent throughout steve.
This commit is contained in:
parent
44e5b8dc3d
commit
95da447d90
@ -1,7 +1,7 @@
|
|||||||
package accesscontrol
|
package accesscontrol
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/rancher/apiserver/pkg/server"
|
apiserver "github.com/rancher/apiserver/pkg/server"
|
||||||
"github.com/rancher/apiserver/pkg/types"
|
"github.com/rancher/apiserver/pkg/types"
|
||||||
"github.com/rancher/steve/pkg/attributes"
|
"github.com/rancher/steve/pkg/attributes"
|
||||||
"github.com/rancher/wrangler/pkg/kv"
|
"github.com/rancher/wrangler/pkg/kv"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type AccessControl struct {
|
type AccessControl struct {
|
||||||
server.SchemaBasedAccess
|
apiserver.SchemaBasedAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAccessControl() *AccessControl {
|
func NewAccessControl() *AccessControl {
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/rancher/apiserver/pkg/server"
|
apiserver "github.com/rancher/apiserver/pkg/server"
|
||||||
"github.com/rancher/apiserver/pkg/types"
|
"github.com/rancher/apiserver/pkg/types"
|
||||||
"github.com/rancher/steve/pkg/accesscontrol"
|
"github.com/rancher/steve/pkg/accesscontrol"
|
||||||
"github.com/rancher/steve/pkg/attributes"
|
"github.com/rancher/steve/pkg/attributes"
|
||||||
@ -55,7 +55,7 @@ type Template struct {
|
|||||||
StoreFactory func(types.Store) types.Store
|
StoreFactory func(types.Store) types.Store
|
||||||
}
|
}
|
||||||
|
|
||||||
func WrapServer(factory Factory, server *server.Server) http.Handler {
|
func WrapServer(factory Factory, server *apiserver.Server) http.Handler {
|
||||||
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
||||||
user, ok := request.UserFrom(req.Context())
|
user, ok := request.UserFrom(req.Context())
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -3,7 +3,6 @@ package handler
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/rancher/apiserver/pkg/server"
|
|
||||||
apiserver "github.com/rancher/apiserver/pkg/server"
|
apiserver "github.com/rancher/apiserver/pkg/server"
|
||||||
"github.com/rancher/apiserver/pkg/types"
|
"github.com/rancher/apiserver/pkg/types"
|
||||||
"github.com/rancher/apiserver/pkg/urlbuilder"
|
"github.com/rancher/apiserver/pkg/urlbuilder"
|
||||||
@ -26,7 +25,7 @@ func New(cfg *rest.Config, sf schema.Factory, authMiddleware auth.Middleware, ne
|
|||||||
|
|
||||||
a := &apiServer{
|
a := &apiServer{
|
||||||
sf: sf,
|
sf: sf,
|
||||||
server: server.DefaultAPIServer(),
|
server: apiserver.DefaultAPIServer(),
|
||||||
}
|
}
|
||||||
a.server.AccessControl = accesscontrol.NewAccessControl()
|
a.server.AccessControl = accesscontrol.NewAccessControl()
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ func New(cfg *rest.Config, sf schema.Factory, authMiddleware auth.Middleware, ne
|
|||||||
|
|
||||||
type apiServer struct {
|
type apiServer struct {
|
||||||
sf schema.Factory
|
sf schema.Factory
|
||||||
server *server.Server
|
server *apiserver.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *apiServer) common(rw http.ResponseWriter, req *http.Request) (*types.APIRequest, bool) {
|
func (a *apiServer) common(rw http.ResponseWriter, req *http.Request) (*types.APIRequest, bool) {
|
||||||
|
Loading…
Reference in New Issue
Block a user