zitadel/internal/api/grpc/admin/server.go
Fabi dc56e298ae
fix: use domain models for v2 eventstore (#1151)
* fix: use domain models for v2 eventstore

* fix: user domain model

* Update internal/api/grpc/admin/login_policy_converter.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* fix: converter

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2021-01-05 09:33:45 +01:00

68 lines
1.6 KiB
Go

package admin
import (
"github.com/caos/zitadel/internal/v2/command"
"github.com/caos/zitadel/internal/v2/query"
"google.golang.org/grpc"
"github.com/caos/zitadel/internal/admin/repository"
"github.com/caos/zitadel/internal/admin/repository/eventsourcing"
"github.com/caos/zitadel/internal/api/authz"
"github.com/caos/zitadel/internal/api/grpc/server"
"github.com/caos/zitadel/pkg/grpc/admin"
)
const (
adminName = "Admin-API"
)
var _ admin.AdminServiceServer = (*Server)(nil)
type Server struct {
command *command.CommandSide
query *query.QuerySide
org repository.OrgRepository
iam repository.IAMRepository
administrator repository.AdministratorRepository
repo repository.Repository
}
type Config struct {
Repository eventsourcing.Config
}
func CreateServer(command *command.CommandSide, query *query.QuerySide, repo repository.Repository) *Server {
return &Server{
command: command,
query: query,
org: repo,
iam: repo,
administrator: repo,
repo: repo,
}
}
func (s *Server) RegisterServer(grpcServer *grpc.Server) {
admin.RegisterAdminServiceServer(grpcServer, s)
}
func (s *Server) AppName() string {
return adminName
}
func (s *Server) MethodPrefix() string {
return admin.AdminService_MethodPrefix
}
func (s *Server) AuthMethods() authz.MethodMapping {
return admin.AdminService_AuthMethods
}
func (s *Server) RegisterGateway() server.GatewayFunc {
return admin.RegisterAdminServiceHandlerFromEndpoint
}
func (s *Server) GatewayPathPrefix() string {
return "/admin/v1"
}